Fetch crypto price data from Coingecko in a format suitable for use in a Google Spreadsheet (via `ImportJSON`)
Simple vanilla js script to download crypto price data from Coingecko
Transforms it into a format that is designed to work well with the Google Sheets ImportJSON appscript.
Edit the symbols.txt
file and put in Coingecko-compatible ids, which come from their coins/list API endpoint.
90% of the time the id is the same as the slug of their token urls, like "ethereum",
but not always. Unfortunately I haven't found a good way to predict when it's not.
Then run the script. To import it into Google Sheets it needs to be publicly accessible, so you could run it on public-facing web server, or save it to a gist or val
./run.sh > /var/www/html/crypto-prices.json
Then in your Google Sheet, try something like:
=ImportJSON("https://yourwebsite.com/crypto-prices.json", "", "rawHeaders,noTruncate,noInherit")
which unfortunately ouputs things as two rows... you can combine them into a more usable 2-column layout with the TRANSPOSE()
function
Could we fix this using a different structure for the JSON? it's a mystery
MIT
Pull requests welcome