Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (2024)

Especially in a fast-moving space like crypto, it can be overwhelming to stay on top of your investments 24/7. In this article, we’ll be sharing how to build your own real-time portfolio tracker using Google Sheets, so you can manage and track your crypto investments easily. Creating your own custom portfolio will allow you to record and calculate your crypto holdings, analyze crypto price and volume changes, and tailor it to your trading preferences. Investors that trade stocks and other assets may even combine this with existing stocks portfolio trackers.

Regardless of whether you’re a beginner or advanced trader, this detailed guide will walk through:

  • How to set your Google Sheet up for auto-refreshes
  • How to import live crypto data via CoinGecko API (for both Demo& Paid API users)
  • How to customize your spreadsheet to calculate crypto holdings, holdings value, and more
  • The benefits of creating a portfolio tracker on Google Sheets

Let’s get started!

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (1)

Create a Live Crypto Portfolio Tracker on Google Sheets in 4 Steps

First, create a new spreadsheet on Google Sheets and name it accordingly. This will be your workspace where you'll input and analyze cryptocurrency data.

Step 1: Import Live Crypto Price Data with App Scripts

Navigate to ‘Extensions’ and select ‘App Script’, where a new tab will appear.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (2)

On the left panel, select ‘< > Editor’ and add a new script using the ‘+’ button. Copy and paste the following importJSON script, and save the script as ‘ImportJSON’.This importJSON script is a versatile one that will allow you to import data in many different ways.

Create a second Apps Script by clicking on the ‘+’ button. Copy the code below and paste it into the script editor, saving it as ‘autoRefresh’ – this will allow your sheet to automatically refresh at fixed intervals.

Your Apps Script editor will now look like this:

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (3)

Step 2: Automate Data Refreshes with Triggers

Now that the scripts have been created, select the clock icon on the left to navigate to ‘Triggers’.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (4)

Clicking on ‘+ Add Trigger’ will cause this pop-up to appear. Select the respective dropdowns accordingly:

  • Choose which function to run: triggerAutoRefresh
  • Choose which deployment should run: Head
  • Select event source: Time-driven
  • Select type of time based trigger: Minutes timer
  • Select minute interval: Every 5 or 10 minutes (note: anything less than this may not be useful, as results are cached)

Depending on your preferred frequency, you may also toggle between Hour timer, Day timer, Week timer, and 15 or 30 minute interval triggers.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (5)

Step 3: Import Top 500 Crypto Data with CoinGecko API

CoinGecko tracks over 12,000 cryptocurrencies across 900exchanges, and is the go-to source for millions of investors globally. Coin rankings are based on market capitalization, so pulling in top 500 cryptocurrencies data would typically be more than sufficient for most investors. Do adjust parameters accordingly if you trade smaller market cap coins!

Head over to our CoinGecko API documentation, and find the endpoint /coins/markets.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (6)

If you have an API key on hand, you may leverage the readme documentation playground to generate a response. Do remember to reference the correct documentation version based on your plan and key authentication. Public APIusers with a Demo Keyshould reference v3.0.1, and Paid API (Pro Key) users should reference v3.1.1.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (7)

As each ‘Page’ tracks 250 coins, we will be importing two pages of coins data via two API calls, to derive the top 500 cryptocurrencies. Leave the ‘ids’ parameter blank, and add the following inputs:

  • Per_page: 250
  • Page: 1

Fill in the rest of the query params accordingly, input your API key under 'Authentication' and, click 'Try It'.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (8)

To pull data for smaller cap coins, change the page number accordingly – for instance, you will be importing coins data for coins ranked between #2500 to #3000, with the ‘Page’ parameter inputs of 11 and 12. This will consume two API calls as well.

In our example, the Request URL is:

https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=250&page=1&sparkline=true&price_change_percentage=1h%2C24h%2C7d&locale=en&precision=3

Copy this and head back to your worksheet.

Label a new worksheet ‘Top 500 Coins’, as this will serve as your raw database and not your actual crypto portfolio dashboard.

In cell A1, use the following and replace the Request URL accordingly.

=IMPORTJSON(“Request URL”,“/name,/current_price,/market_cap,/price_change,/total_volume,/high_24h,/low_24h”,“noTruncate,noHeaders”,doNotDelete!$A$1)

The following script will appear:

=IMPORTJSON(“https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page=1&sparkline=true&price_change_percentage=1h%2C24h%2C7d&locale=en&precision=3?x_cg_demo_api_key=YOUR_API_KEY,“/name,/current_price,/market_cap,/price_change,/total_volume,/high_24h,/low_24h”,“noTruncate”,doNotDelete!$A$1)

Don't forget tosupply your DemoAPI Key to the root URL via the query string parameter.

Once the script loads, a list of top 250 cryptocurrencies and its respective price, market cap data will now stream into your spreadsheet up through row 251.

  • /name – coin name
  • /current_price – coin price
  • /market_cap – all market cap details
  • /price_change – 24hr price change
  • /total_volume – 24hr trading volume
  • /high_24h and /low24 – 24hr high and low prices

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (9)

To pull the next 250 cryptocurrencies, apply the same formula on cell A252 with a few tweaks, or simply copy and paste the formulasbelow!

  • Change page number to ‘2’, since we’re now moving on to Page 2 for the top 251-500 cryptocurrencies
  • Add in ‘,noHeaders’ after “noTruncate” – this prevents duplicating headers (as seen in row 1) on row 252.

DemoAPI users:

=IMPORTJSON(“https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=250&page=2&sparkline=true&price_change_percentage=1h%2C24h%2C7d&locale=en&precision=3?x_cg_demo_api_key=YOUR_API_KEY”,“/name,/current_price,/market_cap,/price_change,/total_volume,/high_24h,/low_24h”,“noTruncate,noHeaders”,doNotDelete!$A$1)

Similarly, due to Google Sheets and Demo API rate limits, you may only be able to import a limited range of data.

Paid API users:

=IMPORTJSON(“https://pro-api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=250&page=2&sparkline=true&price_change_percentage=1h%2C24h%2C7d&locale=en&precision=3?&x_cg_pro_api_key=YOUR_API_KEY”,“/name,/current_price,/market_cap,/price_change,/total_volume,/high_24h,/low_24h”,“noTruncate,noHeaders”,doNotDelete!$A$1)

This robust crypto API integration on Google Sheets allows you to easily fetch real-time prices for the top 500 cryptocurrencies on CoinGecko, and the data automatically refreshes every 10 minutes.

Obtaining Data for Specific Cryptocurrencies

In the scenario where you want to only retrieve data for a specific list of coins, you can fill in the ‘ids’ parameter with the respective coins’ API IDs – this Token API list, created by the CoinGecko team is particularly helpful. Alternatively, you may search for the specific coin on CoinGecko and copy the API id from individual coin pages. For example, XRP’s API id is ‘ripple’.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (10)

Fil in 'ripple' in the 'ids' param,and select 'Try It!'. The response will be generated accordingly.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (11)

We’ll move on to the final step where you can customize your crypto portfolio tracker and dashboard.

Step 4: Configure Your Portfolio Tracker

Now that you have an auto-updating database of the top 500 cryptocurrencies, you can customize your portfolio tracker based on your trading preferences.

Using VLOOKUP, search for the price, market cap, trading volume and % change, based on the Coin Name. In this example, we’ve done a VLOOKUP search of ‘Bitcoin’ in cell B19, cross referencing its price in the Top 500 Coins worksheet.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (12)

Since coin price data is indexed on column 2 of our Top 500 Coins database, we enter ‘2’ in the VLOOKUP formula.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (13)

This method is applied to the rest of the table, returning responding values accordingly.

Finally, create a Portfolio section at the end to track your holdings, calculate holding value and profit and loss (P&L) based on real-time cryptocurrency prices.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (14)

Create the following row headers:

  • Current Holdings – How much of each coin you currently hold.
  • Current Holding Value (USD) – How much value your crypto holdings is worth, in fiat currency, derived by multiplying Current Holdings by Current Price.
  • Total Invested (USD) – Cost of purchase in fiat currency, for each entry.
  • Unrealized P&L (USD) – The profit or loss that could be realized, if the position were closed at that time.
  • Realized P&L (USD) – The actual profit or loss that has been realized, based on closing positions.
  • ROI % – Return on investment, which evaluates how efficient or profitable your investment is. The higher your ROI, the more profitable your investment is.

Finally, you may want to add data visualizations to your crypto portfolio tracker. Adding a chart and a summary can help to organize and present your crypto investments in an easily digestible way, especially if you have a wide range of crypto assets in your basket.

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (15)

As you continue to invest in crypto, you'll need to update your portfolio tracker with new purchase records and remove outdated ones. While calculating trading profits and losses hasn’t been fully covered in this article, we'll be creating a step-by-step guide soonon how to automate P&L – both unrealized, realized, ROI and more.

Here’s the finalCrypto Portfolio Tracker on Google Sheets,automated with App Scripts and CoinGecko API:

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (16)

Benefits of Tracking Your Crypto Portfolio on Google Sheets

Tracking your crypto portfolio on Google Sheets allows you to easily analyze data with charts, pivot tables and formulas across any device, any time. Having auto-refreshing crypto price data also ensures you have an accurate view of all your investments at all times. Investors who diversify their portfolios across crypto, stocks and other assets and are working off Google Sheets, will find it extremely convenient to consolidate and customize all asset holdings in a single, master dashboard.

Why Am I Getting Rate Limited on Google Sheets?

You may be getting rate limited as Google Sheetsrelies on shared hosting, where one Google server hosts multiple sheets. Users making requests on the same server share the same API calls per minute limit. This explains why you may be hitting rate limits or running into an '#ERROR',even when you make only a few API calls or import a small range of data.

Avoid getting rate limited by subscribing to the CoinGecko API Analyst plan. If you’re an existing subscriber and have an API key, use the Pro API root URL (https://pro-api.coingecko.com/api/v3/) and include your API key at the end. This is how the URL structure will appear:

=IMPORTJSON(“https://pro-api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=250&page=1&sparkline=true&price_change_percentage=1h%2C24h%2C7d&locale=en&precision=3?&x_cg_pro_api_key=YOUR_API_KEY”,“/name,/current_price,/market_cap,/price_change,/total_volume,/high_24h,/low_24h”,“noTruncate”,doNotDelete!$A$1)

For Advanced Traders: Useful CoinGecko API Endpoints

Here are some useful API endpoints that advanced traders might find particularly useful:

  • /coins/top_gainers_losers - get the top 30 coins with the largest price gains and losses based on specific time frames
  • /global/market_cap_chart - get historical global market cap and volume data, by no. of days away from now
  • /nfts/markets – track NFT floor prices, market cap and volume

If you're an advanced trader and want access to more comprehensive data, historical prices and bypass rate limits, you may want to consider subscribing to an Analyst API plan.

Credits & Acknowledgements

  • importJSON script by Brad Jasper and Trevor (Github)
  • triggerAutoRefresh script by Andrea Borruso (Github)
Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API (2024)

FAQs

Create a Crypto Portfolio Tracker on Google Sheets (with App Scripts) | CoinGecko API? ›

In your Google Sheets file, select Tools > Script editor. The script editor should open in a new tab. Delete any existing copy. Copy and paste the content of CRYPTOFINANCE.gs into the page.

How do I create a crypto portfolio tracker in Google Sheets? ›

Create a Live Crypto Portfolio Tracker on Google Sheets in 4 Steps
  1. Step 1: Import Live Crypto Price Data with App Scripts. ...
  2. Step 2: Automate Data Refreshes with Triggers. ...
  3. Step 3: Import Top 500 Crypto Data with CoinGecko API. ...
  4. Step 4: Configure Your Portfolio Tracker.
Apr 22, 2024

How do I track cryptocurrency in Google Sheets? ›

In your Google Sheet, type the formula '=GOOGLEFINANCE("BTC-USD")' where you want the live Bitcoin price to appear.
  1. Press Enter, and the cell will display "Loading" before showing the current Bitcoin price. ...
  2. In the 'Settings for this spreadsheet' box, go to the 'Calculation' tab. ...
  3. Click 'Save settings'.
May 23, 2024

How to build a crypto portfolio tracker? ›

Here's a step-by-step guide to creating an Excel crypto tracker.
  1. Step 1: Set Up Your Spreadsheet. ...
  2. Step 2: Fetch Live Price Data. ...
  3. Step 3: Input Your Crypto Transactions. ...
  4. Step 4: Generate Cryptocurrency Price Charts. ...
  5. Step 5: Set Up Data Refresh. ...
  6. Step 6: Regularly Update and Analyze.

How to use cryptofinance on Google Sheets? ›

In your Google Sheets file, select Tools > Script editor. The script editor should open in a new tab. Delete any existing copy. Copy and paste the content of CRYPTOFINANCE.gs into the page.

Is CoinGecko API free? ›

Is CoinGecko API free? CoinGecko API offers both free and paid plans. The Demo API plan is accessible to all CoinGecko users at zero cost, with a stable rate limit of 30 calls/min and a monthly cap of 10,000 calls.

How do I create a tracker in Google Sheets? ›

If you want to make a tracker on Google Sheets that can track tasks, the best way to do it is to list all your tasks in the far left column, and then have a variety of status columns on the right. This could be things like not started, pending, completed and so on. Simply mark the appropriate column for each task.

What is the best crypto portfolio tracking app? ›

Coinstats offers one of the most comprehensive crypto portfolio trackers. It seamlessly connects with over 300 platforms, including crypto exchanges like Coinbase, Kraken, and Binance and wallets like MetaMask and Ledger. It can track all types of assets, including non-fungible tokens (NFTs).

How to create a crypto spreadsheet? ›

Step 1: Install Cryptosheets: Get the add-in from their website. Step 2: Connect Data: Launch Excel, go to Cryptosheets, and connect to your data source. Step 3: Retrieve Data: Use Cryptosheets' functions to get specific cryptocurrency data. Step 4: Organize and Analyze: Organize and visualize data using Excel's tools.

How do I create a portfolio tracker app? ›

Frequently Asked Questions on How to Build a Portfolio App

Choose a cloud platform, technology stack, and development tools. Form a development team and use the “Scrum” technique to manage the project. Develop APIs, design the UI, and code the other components. Test and deploy the app.

How do I use GOOGLEFINANCE API in Google Sheets? ›

Access Google Finance data in Sheets
  1. Create a new sheet in Google Sheets 'sheets. ...
  2. To access the finance data, click on a cell and start your query by entering:=GOOGLEFINANCE(“The full query requires the following:=GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])

How do I use coin market cap API in Google Sheets? ›

How to Add CoinMarketCap API Data to Google Sheets
  1. Get CoinMarketCap API Key. ‍ The CoinMarketCap API can be retrieved through the following link: ...
  2. Copy the CoinMarketCap Sample Spreadsheet. ‍ ...
  3. Add the API Key to the Script. ‍ ...
  4. Run the Script. ‍ ...
  5. Add a Button. ‍ ...
  6. Connect the Script to the Button. ‍

How do I create a stock portfolio in Google Sheets? ›

Create a portfolio
  1. Go to google.com/finance.
  2. On the right, click New portfolio.
  3. Enter a portfolio name.
  4. Click Done.
  5. To add investments, click Add investments.

Does Google have a stock portfolio tracker? ›

Stock Portfolio & Watchlist - Google Finance. Keep track of all your investments, get real time pricing updates, and see your overall portfolio's worth.

How do I create a crypto investment portfolio? ›

How to Build a Crypto Portfolio in 5 Simple Steps
  1. Identify what type of crypto investor you are.
  2. Select a crypto investment strategy that matches your type.
  3. Identify the coins that fit your investment strategy.
  4. Create a crypto portfolio tracker.
  5. Learn from a successful crypto case study.

How do I track crypto portfolio performance? ›

CoinMarketCap is one of the world's most-trusted cryptocurrency price trackers. The company also offers a portfolio tracking product to investors. Though the platform is limited in its functionality, it can be a good option for traders who are on a budget and who prefer to manually enter their cryptocurrency holdings.

Top Articles
VMware Tanzu Cloud Native Application Platform for Multi-cloud
What is NFT Fundraising? - The Giving Block
Poe T4 Aisling
Tlc Africa Deaths 2021
Craigslist Campers Greenville Sc
Us 25 Yard Sale Map
Apply A Mudpack Crossword
litter - tłumaczenie słowa – słownik angielsko-polski Ling.pl
Spelunking The Den Wow
Slope Unblocked Minecraft Game
Mens Standard 7 Inch Printed Chappy Swim Trunks, Sardines Peachy
Bestellung Ahrefs
I Wanna Dance with Somebody : séances à Paris et en Île-de-France - L'Officiel des spectacles
Aberration Surface Entrances
Michigan cannot fire coach Sherrone Moore for cause for known NCAA violations in sign-stealing case
Nhl Wikia
Dover Nh Power Outage
Allybearloves
Puretalkusa.com/Amac
Parc Soleil Drowning
Ice Dodo Unblocked 76
Rapv Springfield Ma
Rogue Lineage Uber Titles
Trivago Myrtle Beach Hotels
Lexus Credit Card Login
Tire Plus Hunters Creek
Jurassic World Exhibition Discount Code
Pixel Combat Unblocked
Stephanie Bowe Downey Ca
Franklin Villafuerte Osorio
Davita Salary
Hoofdletters voor God in de NBV21 - Bijbelblog
The value of R in SI units is _____?
Envy Nails Snoqualmie
24 slang words teens and Gen Zers are using in 2020, and what they really mean
Sedano's Supermarkets Expands to Orlando - Sedano's Supermarkets
El agente nocturno, actores y personajes: quién es quién en la serie de Netflix The Night Agent | MAG | EL COMERCIO PERÚ
Selfservice Bright Lending
1-800-308-1977
School Tool / School Tool Parent Portal
Weapons Storehouse Nyt Crossword
Atlanta Musicians Craigslist
Simnet Jwu
Craigs List Hartford
Torrid Rn Number Lookup
Thor Majestic 23A Floor Plan
Busted Newspaper Mcpherson Kansas
Ohio Road Construction Map
Actress Zazie Crossword Clue
Colin Donnell Lpsg
What Is The Gcf Of 44J5K4 And 121J2K6
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 6747

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.