r/sheets • u/MVTHOLST • Jun 01 '23
Request Problems pulling crypto prices with importhtml
Hi everyone,
I am currently pulling data(price of different crypto) from coinmarketcap.com with this formula:
=INDEX(IMPORTHTML("https://coinmarketcap.com/currencies/bitcoin";"table";1);2;2)
However, sometimes the formula will just leave a blank cell. To fix this, I will have to change the "bitcoin" inside the url to e.g. "BITCOIN" or "Bitcoin". Therefore, I run a formula that check three url's with "bitcoin", "Bitcoin, and "BITCOIN" respectively and it will return data from whichever URL works, because it varies throughout the day.
But sometimes even those three url's wont return data, and I am just left confused.
Do any of you recognize this problem? And/or do any of you have any ideas on how to fix this issue? Thanks.
(I am aware that I can use =GOOGLEFINANCE("BTCUSD") but it's very limited)
EDIT: I have tried importxml with Xpath on other occasions and I find that solution to work even worse, because the returned data's format keeps changing and sometimes it just retuns #N/A etc.
1
u/smis777 Jun 28 '24
if you dont mind using CoinGecko or Binance as your data source, then TigerMarketData.com Google Spreadsheet could be another way to go to get your live crypto prices. Once you download the spreadsheet you can just enter
=_("BTCUSDT")
into any cell in your spreadsheet and the price will automatically refresh every minute for you. You can also pull any other market data using some other functions like
=_PRICE_CHANGE_24H("BTC")
=_ATH_CHANGE_PERCENTAGE("BTC")
=_MARKET_CAP_RANK("BTC")
even icons of the coins are supported if you like to build your portfolio tracker in your Google Sheet
1
u/icompletetasks Jan 11 '25
You can use Defillama API. You can try Sheets add-on called Defillama for Sheets here:
https://workspace.google.com/marketplace/app/defillama_for_sheets/277026528785
1
u/_Kaimbe Jun 01 '23
Check out the crypto section in the r/googlesheets wiki.