How to Auto Update Crypto Prices in Google Sheets

·

Keeping track of your cryptocurrency balances in Google Sheets? Here’s a step-by-step guide to automatically pulling in crypto prices—completely free.


Step 1: Get Your API Key

To fetch live crypto prices, you’ll need an API key from CoinMarketCap.

  1. Sign up for the free plan.
  2. Generate your API key under settings and save it for later.

👉 Need help choosing a crypto tracker?


Step 2: Set Up Your Google Sheet

  1. Create a new sheet named "CoinMarketCap".
  2. Navigate to Extensions > Apps Script to open the script editor.

Step 3: Add the Code

Copy the script below into Apps Script. Replace {your API Key} with your actual key and adjust the coin symbols (e.g., BTC, ETH) to match your portfolio.

function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Crypto Menu')
    .addItem('Refresh coinpanel', 'callCoinBase')
    .addToUi();
}

function callCoinBase() {
  var options = {
    "async": true,
    "crossDomain": true,
    "method": "GET",
    "headers": {
      "X-CMC_PRO_API_KEY": "{your API Key}",
      "Accept": "application/json"
    }
  };
  
  var response = UrlFetchApp.fetch(
    "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=BOBA,BTC,ETH,FTM,VET,THETA,ZIL,COTI,AR,SOL,MATIC,GRT,DOT,1INCH,ADA,LUNA,AVAX,TLM,RNDR,MANA,SRM,RIN,SBR,FTM,MOVR,LINK,AKT,ALGO,SUPER,RUNE,RMRK,CLV,SCLP,SOLR,UST,AIOZ,SFUND,INJ,TOMB,HERO,DON,XRP,BNB,RACEFI,TIME,BTC,STATIC,QRDO,GARI,WMEMO,TOMB,TSHARE,LOOP,PTP,KUJI,PRISM,TIME,BGS", 
    options
  );
  
  var data = JSON.parse(response.getContentText()).data;
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheets = spreadsheet.getSheets();
  
  for (sheetNum in sheets) {
    if (spreadsheet.getSheets()[sheetNum].getSheetName() == "CoinMarketCap") {
      spreadsheet.setActiveSheet(spreadsheet.getSheets()[sheetNum]);
      var sheet = SpreadsheetApp.getActiveSheet();
      var x = 1;
      
      for (coin in data) {
        sheet.getRange(x, 1).setValue(coin);
        sheet.getRange(x, 2).setValue(data[coin].quote.USD.price);
        x++;
      }
    }
  }
}

This script adds a custom menu to your sheet for one-click price updates.

Note: Ignore security warnings—these appear because you’re executing your own code.

👉 Optimize your crypto strategy with these tools


FAQ

Q1: How often do prices update?
A: Prices refresh only when you click the menu button. For real-time updates, use Google Script’s time-driven triggers.

Q2: Can I add more coins?
A: Yes! Edit the symbol= parameter in the script (e.g., symbol=BTC,ETH,SOL).

Q3: Is this method secure?
A: Absolutely. Your API key runs locally in Apps Script, not on third-party servers.


Conclusion

With this setup, you’ll never manually update crypto prices again. It’s free, automated, and tailored to your portfolio.

For advanced tracking, explore 👉 crypto portfolio managers.