Bryan
Bryan

Reputation: 13

Google Sheets ImportXML on Coinmarketcap.com

I have a google sheet that I use to track crypto positions and I'm using ImportXML to grab the current price of the coin off of coinmarketcap.com. All of them work with the same set of parameters:

  1. URL https://coinmarketcap.com/currencies//
  2. Full XPath: /html/body/div[1]/div[1]/div/div[2]/div/div[1]/div[2]/div/div[2]/div[1]/div/span

Formula: =IMPORTXML("https://coinmarketcap.com/currencies/the-sandbox/", "/html/body/div[1]/div[1]/div/div[2]/div/div[1]/div[2]/div/div[2]/div[1]/div/span", "en US")

This works for every coin I've tried EXCEPT SAND (https://coinmarketcap.com/currencies/the-sandbox/) and I've no clue why. I have tried pretty much every combination of the path I can think of.

Does anyone have any ideas? I am totally stuck on this one.

Upvotes: 1

Views: 8114

Answers (2)

Adam Studenik
Adam Studenik

Reputation: 1

If you want have pure number without $ try this:

=VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(IMPORTXML("https://coinmarketcap.com/currencies/ethereum/";  "//div[@class='priceValue ']") ;"$";"");",";"");".";","))

Upvotes: 0

player0
player0

Reputation: 1

try:

=IMPORTXML("https://coinmarketcap.com/currencies/the-sandbox/"; 
 "//div[@class='priceValue ']")

enter image description here

Upvotes: 2

Related Questions