I’m struggling to pull market data from a crypto stats website into my Google Sheet. The usual import functions aren’t working. I tried using IMPORTDATA
with ARRAY_CONSTRAIN
but it’s not giving me what I need.
Here’s what I’ve tried:
=ARRAY_CONSTRAIN(IMPORTDATA("crypto-stats-website.com/chart"), 1, 300)
This grabs some data, but not the specific info I want like Market Cap, Circulating Supply, and Pool percentages.
Is there a way to target these exact data points? I’d love a flexible solution that lets me choose which stats to import.
Any ideas would be super helpful! I’m out of tricks here.
Have you considered using Google Apps Script to create a custom function? It’s a powerful tool for situations where built-in functions fall short. You can write a script to fetch the data via HTTP requests and parse the response to extract exactly what you need. This approach gives you full control over the data retrieval process and allows you to target specific elements on the page. It’s more complex than simple formulas, but it’s incredibly flexible and can handle dynamic content that often causes issues for IMPORTDATA and similar functions. If you’re comfortable with basic JavaScript, this could be a robust solution for your needs.
I’ve faced similar challenges with crypto data, and what worked for me was using the IMPORTJSON function. It’s not a built-in function, but you can add it to your sheet as a custom function.
First, you’ll need to set up the IMPORTJSON function in your Google Apps Script editor. There are several versions available online - I used the one from Brad Jasper’s blog.
Once set up, you can use it like this:
=IMPORTJSON(“https://api.coingecko.com/api/v3/coins/bitcoin”, “/market_data/market_cap/usd, /market_data/circulating_supply”, “noInherit,noTruncate,noHeaders”)
This fetches data directly from CoinGecko’s API, which is more reliable than scraping websites. You can modify the URL and JSON paths to get exactly what you need. It’s been a game-changer for my crypto tracking sheets.
hey there SwimmingShark, have u tried using IMPORTXML instead? it’s pretty good for grabbing specific data. You’ll need to inspect the page source to find the right XPath for each stat you want. might take some trial and error but it’s worth a shot. lmk if u need help figuring out the XPath stuff!