How to Import Crypto Prices in Google Sheets

·

Tracking cryptocurrency prices in real time is essential for investors, traders, and analysts. While many platforms offer live data, integrating this information directly into a spreadsheet can streamline portfolio tracking, analysis, and reporting. Google Sheets, with its powerful scripting capabilities, allows you to pull live crypto prices using a custom function. This guide walks you through the process step by step, so you can automate price tracking without leaving your spreadsheet.

Whether you're monitoring Bitcoin, Ethereum, or altcoins, this method supports multiple cryptocurrencies and fiat currencies like USD, EUR, and GBP. By the end of this tutorial, you’ll have a working GETCRYPTOPRICE function that fetches real-time data with ease.

Step 1: Add the Script to Google Sheets

To begin, you need to embed a custom script in Google Sheets using Apps Script, Google’s cloud-based JavaScript platform. This script will make API calls to retrieve cryptocurrency pricing data.

  1. Open your Google Sheet.
  2. Click on Extensions in the top menu.
  3. Select Apps Script.

This opens the Apps Script editor in a new tab. By default, there may be some placeholder code. Replace all existing code with the following:

const CMC_PRO_API_KEY = "YOUR_API_KEY";

function GETCRYPTOPRICE(ticker, currency) {
  try {
    const res = UrlFetchApp.fetch(`https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=${ticker}&convert=${currency}&CMC_PRO_API_KEY=${CMC_PRO_API_KEY}`);
    const content = res.getContentText();
    const json = JSON.parse(content);
    return json.data[ticker.toUpperCase()].quote[currency.toUpperCase()].price;
  }
  catch (err) {
    return "Error: Unable to fetch data";
  }
}

After pasting the code:

👉 Automate your crypto tracking with powerful tools and templates.

Step 2: Get Your CoinMarketCap API Key

The script relies on the CoinMarketCap Pro API to fetch live prices. To use it, you need a free API key:

  1. Visit the CoinMarketCap API portal.
  2. Click "Get Your API Key Now".
  3. Sign up using your email or social account — registration takes under two minutes.
  4. After logging in, go to your Dashboard.
  5. Under your account details, click "Copy" next to your API key.

Keep this key secure — it authenticates your requests to the API.

Step 3: Insert Your API Key Into the Script

Return to the Apps Script editor where you pasted the code earlier.

Locate this line:

const CMC_PRO_API_KEY = "YOUR_API_KEY";

Replace "YOUR_API_KEY" with your actual API key in quotes:

const CMC_PRO_API_KEY = "b5e8d36a-d1c9-4b4d-a9b7-1c8b7f3d6e5a"; // Example key format

Click Save Project again to ensure changes are stored.

⚠️ Note: Never share your API key publicly. If exposed, regenerate it immediately from your CoinMarketCap dashboard.

Step 4: Use the GETCRYPTOPRICE Function in Google Sheets

Now that the script is set up and authenticated, you can use the custom function directly in any cell.

The syntax is simple:

=GETCRYPTOPRICE("TICKER", "FIAT_CURRENCY")

Examples:

Just enter the formula into any cell, and within seconds, the current market price will appear. The data updates whenever the sheet recalculates (e.g., on refresh or edit).

👉 Access real-time crypto data and advanced trading tools today.

Step 5: Monitor Your Portfolio Automatically

With live pricing integrated, you can build a dynamic crypto portfolio tracker. Create columns for:

This setup enables automatic calculations as prices update. You can even schedule time-driven triggers via Apps Script to log historical prices at specific intervals.

Pro Tips:

Frequently Asked Questions

Can I track multiple cryptocurrencies at once?

Yes! Simply apply the GETCRYPTOPRICE function across multiple rows or columns, each targeting a different cryptocurrency. For example, one row for BTC, another for ETH, and so on.

Is this method free to use?

The script itself is free. However, you’ll need a CoinMarketCap API key, which offers a free tier with limited daily requests. For higher volume or commercial use, consider upgrading to a paid plan.

Why am I getting an error when using the function?

Common causes include:

Double-check your key and syntax. If problems persist, temporarily replace the key in the URL and test it directly in a browser.

Does Google Sheets update prices in real time?

Not continuously. Prices update when:

For true real-time updates, set up a time-driven trigger in Apps Script to refresh every few minutes.

Can I use other APIs instead of CoinMarketCap?

Yes, though this guide uses CoinMarketCap due to its reliability and clear documentation. Alternatives include CoinGecko (free) or CryptoCompare. Each requires adjusting the API endpoint and response parsing logic.

Is my API key safe in Apps Script?

While Apps Script projects are private by default, avoid sharing your script or publishing it publicly. Also, never hardcode sensitive keys in client-side code or public repositories.

👉 Discover how top traders leverage real-time data for smarter decisions.

Final Thoughts

Integrating live cryptocurrency prices into Google Sheets transforms it from a static spreadsheet into a powerful financial dashboard. With just a few lines of code and a free API key, you gain access to real-time market data that can power personal trackers, investment reports, or even automated alerts.

This solution is ideal for anyone looking to stay informed without relying on third-party apps. And once you’ve mastered this technique, you can expand it further — pulling market caps, 24-hour changes, or even NFT floor prices with similar methods.

By combining automation with accurate data sources, you take control of your crypto insights — all within a familiar tool.


Core Keywords: import crypto prices, Google Sheets crypto, live cryptocurrency data, crypto portfolio tracker, GETCRYPTOPRICE function, CoinMarketCap API, real-time crypto prices, automate crypto tracking