How To Get Current Crypto Prices into a Google Sheet Using Google Scripts and the CoinMarketCap API

1. Sign up for an account with CoinMarketCap at coinmarketcap.com.

2. Get an API key: Go to Settings > Products > Crypto API, or just click here.

3. Create a Google Sheet where you want the prices to update, like this one. You can actually make a copy of that one and use it as your template. If you’re going to use this script, your Google Sheet does need to look like the sheet CryptoPriceList.

4. Put the token Symbol and ID into the Google Sheet for the tokens you want the prices for. To get the token IDs, you’ll need to pull them from the API or from the CoinMarketCap webpage like this:

Run this in terminal and search the results for the token symbol you want, “ETH” for example (include the quotes in your search string), in the page text and look next to the Symbol for the ID:

curl -H “X-CMC_PRO_API_KEY: YOUR_API_KEY” -H “Accept: application/json” -d “start=1&limit=5000&convert=USD” -G https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest

OR

Pull it from the token’s CoinMarketCap webpage https://coinmarketcap.com/currencies/ethereum/ by viewing the page source in your browser and searching for this data: “”pageProps”:{“info”:{“id”:1027 … “

It will look like this:

5. That’s all. Now click the button and watch the prices update.

Here’s the code on Github.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s