1

Hello does anybody know how to import the Bitcoin price in euro into a Google Sheets document by using the IMPORTXML function?

I am as far as I get the Bitcoin USD price -

=IMPORTXML("https://coinmarketcap.com/currencies/bitcoin/";
"//span[@class='h2 text-semi-bold details-panel-item--price__value']")

by inspecting the CoinMarketCap site I can see the Bitcoin euro price is shown but I do not understand how to refer to it?

<span class="h2 text-semi-bold details-panel-item--price 
value" data-currency-value="">€3.211,55</span>

2 Answers 2

0

That won't be possible because button which switches between currencies is controlled by JavaScript and Google Sheets can't read JS. A workaround would be to use a different site for scraping or convert USD to EUR directly in the spreadsheet:

=IMPORTXML("https://coinmarketcap.com/currencies/bitcoin/";
 "//span[@class='h2 text-semi-bold details-panel-item--price__value']")
 *GOOGLEFINANCE("currency:usdeur")

enter image description here

If the GOOGLEFINANCE currency rate isn't satisfactory you can try to find a better one and IMPORTXML it too - like: =IMPORTXML(usd) * IMPORTXML(currency rate)

1
  • Thank you. I did not want to import to many data, since I think my Google Sheet becomes loaded, however it seems its the only way. Is it possible to write a function for this? I do not want to retrieve too many data at once, since I have the feeling the process of retrieving data could slow down my workbook. Anyhow, thanks for the clerification, I did not know that its controlled by an JavaScript. I thought I just need to querry differently.
    – Mr.Man
    Feb 12, 2019 at 20:10
0

CMC change your structure. The new code to use this is:

=IMPORTXML("https://coinmarketcap.com/currencies/bitcoin/", "//span[@class='cmc-details-panel-price__price']")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.