Google Sheets – Import Bitcoin Price in EUR Using IMPORTXML

formulasgoogle sheetsgoogle-financeimportxmlxpath

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>

Best Answer

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)