Google Apps Script custom functions for tracking crypto portfolios in Google Sheets
MIT License
A collection of Google Apps Script custom functions for tracking crypto portfolios in Google Sheets.
The price data is pulled using CoinGecko's API, and the token balances are obtained by making queries to various RPC servers like PublicNode.
If this project helped you, consider buying me a coffee via 3Cities or GitHub Sponsors.
chainIDs
and tokenData
variables.GET_ALL_PRICES
function.GET_ERC20_BALANCE
and GET_NATIVE_BALANCE
functions to query your holdings in real-time.INDEX
and MATCH
.[!NOTE]
The
GET_ALL_PRICES
can only be run from within Apps Script. See the Custom Functions section below.
The template shows how to query balances for ARB, ETH, MKR, and OP, and how to calculate the values of the holdings:
I built this because I was frustrated with the existing solutions, which are either too complex, too expensive, or too unstable.
Cryptfolio is:
This project is meant to be forked and customized to your needs. Here are two common use cases:
To track a new chain:
Chains
sheet in the spreadsheet.chainIds
in cryptfolio.gs
.To track a new token:
Prices
sheet in the spreadsheet. Ensure that the CRYPTO_IDS
range got updated, too.tokenData
object in cryptfolio.gs
.Here's a table with the custom functions enabled by this project.
The Read functions can be called from either Google Sheets or Apps Script, but the Write functions can only be run from within the Apps Script environment. This is because a custom function cannot affect cells other than those it returns a value to.
Function | Type | Params | Description |
---|---|---|---|
GET_ERC20_BALANCE |
Read | (chainID,symbol,account) | Get the ERC-20 token balance of account on the chain with ID chainID
|
GET_EVM_NATIVE_BALANCE |
Read | (chainID,account) | Get the EVM native asset balance of account on the chain with ID chainID
|
GET_ALL_PRICES |
Write | (fiat) | Get the current fiat prices for all CRYPTO_IDS
|
GET_PRICE |
Write | (crypto,fiat) | Get the current fiat price for crypto
|
Feel free to dive in! Open an issue, start a discussion or submit a PR.
This project couldn't exist without the CoinGecko API. Thank you for providing such a valuable service for free!
This project is licensed under MIT.