◈   ⌘ api · Intermediate

Crypto Price API in Google Sheets: A Trader's Guide

A practical guide to connecting crypto price APIs to Google Sheets. Learn to track live prices from Binance, CoinGecko, and more with real code examples.

Uncle Solieditor · voc · 21.04.2026 ·views 27
◈   Contents
  1. → Why Traders Use Google Sheets for Crypto Price Tracking
  2. → Setting Up Google Apps Script to Fetch Crypto Prices
  3. → Fetching Live Prices with the CoinGecko API in Python
  4. → Connecting to the Binance API with Authentication
  5. → Building a Real-Time Portfolio Dashboard in Google Sheets
  6. → Frequently Asked Questions
  7. → Conclusion

Google Sheets combined with a crypto price API is one of the most underrated setups in a trader's toolkit. Whether you're tracking positions across Binance, Bybit, and OKX, or monitoring 30 altcoins at once, pulling live prices directly into a spreadsheet gives you flexibility that no pre-built dashboard can match. No subscription fees, no arbitrary limitations — just raw data flowing exactly where you need it.

Why Traders Use Google Sheets for Crypto Price Tracking

Most crypto apps show you what they want you to see. Google Sheets shows you what you need to see. You control the layout, the formulas, the conditional alerts — everything. Combined with crypto prices google sheets integration through an API, you get a fully custom analytics environment built around your actual trading strategy rather than some product team's assumptions.

The setup has three layers: the API source (where prices come from), the connection layer (how they get into your sheet), and the dashboard (how you display and analyze them). We'll cover all three with working code.

Setting Up Google Apps Script to Fetch Crypto Prices

The fastest way to pull crypto prices into Google Sheets without leaving the browser is Google Apps Script — it's JavaScript that runs natively inside your spreadsheet. No servers, no installations, no external dependencies. Open your spreadsheet, go to Extensions → Apps Script, paste the code below, and you're live.

function getCryptoPrice(coinId) {
  var url = 'https://api.coingecko.com/api/v3/simple/price?ids=' + coinId + '&vs_currencies=usd&include_24hr_change=true';
  var response = UrlFetchApp.fetch(url);
  var data = JSON.parse(response.getContentText());
  return data[coinId]['usd'];
}

function updateCryptoPrices() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var coins = [
    ['bitcoin', 'BTC'],
    ['ethereum', 'ETH'],
    ['solana', 'SOL'],
    ['binancecoin', 'BNB']
  ];

  for (var i = 0; i < coins.length; i++) {
    try {
      var price = getCryptoPrice(coins[i][0]);
      sheet.getRange(i + 2, 1).setValue(coins[i][1]);
      sheet.getRange(i + 2, 2).setValue(price);
      sheet.getRange(i + 2, 3).setValue(new Date());
    } catch (e) {
      sheet.getRange(i + 2, 2).setValue('API Error: ' + e.message);
    }
  }
}

// Run updateCryptoPrices() once manually to authorize, then call this
function createTimeTrigger() {
  ScriptApp.newTrigger('updateCryptoPrices')
    .timeBased()
    .everyMinutes(5)
    .create();
}

Run updateCryptoPrices() once manually to grant authorization. After that, call createTimeTrigger() once to set up automatic 5-minute refreshes. Your sheet will now update silently in the background, even when you're not looking at it.

Fetching Live Prices with the CoinGecko API in Python

If you prefer Python — or you want to push data into Google Sheets from an external script via the Sheets API — CoinGecko's free tier is the standard starting point. It requires zero authentication for basic price queries and covers every major coin listed on Coinbase, Binance, Gate.io, and KuCoin. The endpoint is stable, well-documented, and the response format is consistent.

import requests

def get_crypto_prices(coin_ids, currency='usd'):
    url = 'https://api.coingecko.com/api/v3/simple/price'
    params = {
        'ids': ','.join(coin_ids),
        'vs_currencies': currency,
        'include_24hr_change': 'true',
        'include_market_cap': 'true'
    }

    try:
        response = requests.get(url, params=params, timeout=10)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.Timeout:
        print('Request timed out — CoinGecko may be rate limiting you')
        return {}
    except requests.exceptions.HTTPError as e:
        print('HTTP error: ' + str(e))
        return {}

coins = ['bitcoin', 'ethereum', 'solana', 'binancecoin', 'ripple']
prices = get_crypto_prices(coins)

for coin, data in prices.items():
    price = data.get('usd', 0)
    change = data.get('usd_24h_change', 0)
    mcap = data.get('usd_market_cap', 0)
    print(
        coin + ': $' + str(round(price, 4)) +
        ' | 24h: ' + str(round(change, 2)) + '%' +
        ' | MCap: $' + str(round(mcap / 1e9, 2)) + 'B'
    )

The free CoinGecko tier allows 30 requests per minute. For portfolio tracking that's plenty — you're pulling snapshots, not streaming a feed. If you do hit the limit, add a small time.sleep(2) between batched calls. The Pro tier unlocks 500 calls/minute if you scale up.

Connecting to the Binance API with Authentication

When you need more than spot prices — actual account balances, order history, real-time order book depth — the Binance API goes deeper. Public endpoints (price, klines, 24h stats) require zero authentication. Private endpoints need an API key generated from your Binance account under Settings → API Management.

import hmac
import hashlib
import time
import requests
import os

API_KEY = os.environ.get('BINANCE_API_KEY', '')
SECRET_KEY = os.environ.get('BINANCE_SECRET_KEY', '')
BASE_URL = 'https://api.binance.com'

def get_price(symbol):
    url = BASE_URL + '/api/v3/ticker/price'
    response = requests.get(url, params={'symbol': symbol}, timeout=10)
    response.raise_for_status()
    return float(response.json()['price'])

def get_24h_stats(symbol):
    url = BASE_URL + '/api/v3/ticker/24hr'
    response = requests.get(url, params={'symbol': symbol}, timeout=10)
    response.raise_for_status()
    return response.json()

def signed_request(endpoint, params=None):
    if params is None:
        params = {}
    params['timestamp'] = int(time.time() * 1000)
    query = '&'.join([str(k) + '=' + str(v) for k, v in params.items()])
    sig = hmac.new(
        SECRET_KEY.encode('utf-8'),
        query.encode('utf-8'),
        hashlib.sha256
    ).hexdigest()
    headers = {'X-MBX-APIKEY': API_KEY}
    url = BASE_URL + endpoint + '?' + query + '&signature=' + sig
    return requests.get(url, headers=headers, timeout=10).json()

# Public endpoints — no auth needed
print('BTC/USDT: $' + str(get_price('BTCUSDT')))
print('ETH/USDT: $' + str(get_price('ETHUSDT')))

stats = get_24h_stats('SOLUSDT')
print('SOL 24h high: $' + stats['highPrice'])
print('SOL 24h volume: ' + str(round(float(stats['volume']), 2)))

# Private endpoint — requires valid API key and secret
account = signed_request('/api/v3/account')
non_zero = [b for b in account.get('balances', []) if float(b['free']) > 0]
for b in non_zero:
    print(b['asset'] + ': ' + b['free'])
Security rule: never hardcode API keys in your script. Load them from environment variables or a .env file and never commit secrets to git. On Binance, restrict your API key to read-only access unless you explicitly need trading permissions — this limits blast radius if a key ever leaks.

Building a Real-Time Portfolio Dashboard in Google Sheets

With live prices flowing in through Apps Script, the next step is structuring a dashboard that calculates your full P&L automatically. Here's the column layout that works cleanest for active traders holding positions across multiple exchanges.

Recommended portfolio tracker structure for Google Sheets
ColumnFormula / SourcePurpose
A: AssetManual entryTicker symbol (BTC, ETH, SOL)
B: Price (USD)Apps Script live fetchRefreshed every 5 minutes
C: HoldingsManual entryNumber of coins held
D: Value (USD)=B2*C2Current position value in USD
E: Avg Buy PriceManual entryYour cost basis per coin
F: P&L (USD)=(B2-E2)*C2Unrealized profit or loss
G: P&L (%)=(B2-E2)/E2*100Percentage gain or loss
H: ExchangeManual entryWhere the position is held

Add a SUM row at the bottom of columns D and F to see total portfolio value and total unrealized P&L in one glance. Apply conditional formatting to column G — green background for positive values, red for negative — and you have a visual risk monitor. For the Exchange column, being specific matters: knowing your ETH sits on Bybit while your SOL is on OKX helps you spot liquidity concentration risk if one platform has issues.

For traders who want signal intelligence layered on top of raw price data, VoiceOfChain delivers real-time trading signals you can cross-reference against your portfolio sheet. When a coin you're holding starts generating unusual signal activity, knowing before the price move completes is the entire edge.

Frequently Asked Questions

Is the CoinGecko API free for use in Google Sheets?
Yes. CoinGecko's public API requires no authentication and allows up to 30 requests per minute at no cost. This is sufficient for most personal portfolio tracking setups in Google Sheets. If you need higher throughput, their paid Pro tier unlocks 500 calls per minute.
How often can I refresh crypto prices automatically in Google Sheets?
Google Apps Script triggers support refresh intervals as short as 1 minute. In practice, every 5 minutes is the sweet spot — it stays well within CoinGecko's free rate limits while keeping prices current enough for portfolio monitoring rather than active trading.
Do I need coding experience to use a crypto price API in Google Sheets?
For the Apps Script approach, you can copy the code examples above verbatim and they will work without modification — no prior JavaScript experience required. For Python scripts that push data via the Sheets API, basic familiarity with Python is helpful but the patterns shown here are straightforward to adapt.
Which API is better for Google Sheets — CoinGecko or Binance?
CoinGecko is better for broad market data across thousands of coins with zero authentication setup. Binance API is better when you need account-specific data like balances, order history, or real-time depth for pairs actively traded on Binance. Many traders use both simultaneously for different columns.
Can I track prices from multiple exchanges like Bybit and OKX in one sheet?
Yes. Both Bybit and OKX expose public REST API endpoints for price data that follow the same pattern as the Binance examples above. You can extend the Apps Script or Python code to query each exchange separately and consolidate results into one unified Google Sheet.
Is it safe to connect a Binance API key to a Google Sheets script?
It's safe if you follow the right practices: generate a read-only API key with no withdrawal permissions, store it using Apps Script's PropertiesService rather than hardcoding it in the script, and never share the spreadsheet publicly. A read-only key with IP restrictions adds another layer of protection.

Conclusion

A crypto price API connected to Google Sheets gives you a level of control over your portfolio data that no off-the-shelf dashboard can replicate. Start with the Apps Script setup for zero-friction live prices, add Python scripts when you need more power, and layer exchange-specific data from Binance, Bybit, or OKX as your tracking needs grow. The infrastructure is free, the flexibility is unlimited, and once the setup is done it runs quietly in the background while you focus on trading.

◈   more on this topic
◉ basics Mastering the ccxt library documentation for crypto traders ⌂ exchanges Mastering the Binance CCXT Library for Crypto Traders ⌬ bots Best Crypto Trading Bots 2025: Profitable AI-Powered Strategies