Is there a way to dynamically link cell values in Google Sheets formulas?

Need assistance with creating a flexible crypto tracking sheet

I’m currently working on a portfolio tracker using Google Sheets. I have a column labeled “TICKER” and another named “PRICE”, where I use importJSON to retrieve market data. However, I find it tedious to update the coin identifier whenever I change the ticker in the first column. I’m looking for a method to incorporate the cell value into my formula similar to string interpolation in programming languages.

Here’s an example of what I’m trying to get to work:

TICKER    PRICE
BTC       =importJSON("https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=" & A2, "0.current_price")

I would like the formula to automatically pull in the ticker from the first column, allowing for seamless updates without the need for manual changes.

i wrap the whole thing in arrayformula so it auto-fills when i add new tickers. like =arrayformula(importJSON("https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=" & A2:A, "current_price")) - saves copying formulas around.

yup, ur formula looks good! just make sure ur ticker symbols are exact with CoinGecko’s API - BTC is fine, but like eth is ‘ethereum’, not ‘ETH’. also, it might be good to add some error handling in case the API has issues.

Your concatenation approach should work great for dynamic linking. I’ve built several similar trackers and the ampersand operator is solid for this. Watch out though - CoinGecko’s ID formats don’t always match ticker symbols. You’ll probably need a lookup table or VLOOKUP to map common tickers like ETH to their API identifiers like ‘ethereum’. Also, wrap your formula in IFERROR to handle failed API calls or weird data. ImportJSON gets cranky with API rate limits, so consider adding some caching if you’re tracking multiple coins.

Been working with Google Sheets API integrations for years - your concatenation syntax looks perfect. The biggest issue I hit with crypto trackers? Many APIs need specific coin identifiers that don’t match regular ticker symbols. For CoinGecko, I’d create a helper column that converts your tickers to their format first, then feed that into the formula. Also throw some data validation on your ticker column - typos will break those API calls fast. If you’re scaling this up, ditch importJSON and use Google Apps Script instead. It handles rate limiting way better and won’t bog down your sheet.

The Problem:

You’re experiencing challenges using Google Sheets and the importJSON function to track your cryptocurrency portfolio. Specifically, you want to dynamically update the cryptocurrency ticker symbol in your formula without manually editing the formula each time you add a new coin. Your current approach requires manual intervention, making it inefficient and prone to errors.

:thinking: Understanding the “Why” (The Root Cause):

Using importJSON directly within Google Sheets for live cryptocurrency data presents several limitations. The primary issue is the manual updating of the ticker symbol within the formula itself. This becomes cumbersome when managing a portfolio with many different cryptocurrencies. Moreover, relying solely on Google Sheets for real-time data can lead to performance issues, API rate limits, and potential data inconsistencies due to network delays or API downtime. A more robust solution involves automating the data fetching and processing, separating it from the limitations of Google Sheets’ formula engine.

:gear: Step-by-Step Guide:

This guide recommends automating your cryptocurrency portfolio tracking using an external tool instead of solely relying on Google Sheets formulas. This approach offers improved reliability, scalability, and efficiency compared to the importJSON method. The example below uses a no-code platform like Latenode, but other comparable tools can achieve similar results.

  1. Automate with an External Tool (e.g., Latenode): Choose a platform that allows you to build automated workflows to manage data. These platforms generally allow you to:

    • Connect to your Google Sheet to access your cryptocurrency data (tickers and other relevant information).
    • Define your data sources: specify the column containing your cryptocurrency ticker symbols.
    • Fetch Real-time Data: Pull the current prices from external APIs (such as CoinGecko’s API, or others). The tool’s automation will handle API calls and any necessary data transformations. The platform’s API connectors simplify the process, so you don’t need extensive coding.
    • Map and Transform Data: Configure your workflow to map the fetched prices to the correct tickers in your Google Sheet.
    • Update your Spreadsheet: Automatically update your Google Sheet with the current prices. The frequency of updates (e.g., every few minutes) is easily configurable.
    • Handle Errors: Implement error handling to manage situations where API calls fail or data is unavailable.
  2. Setup in Latenode (Example): This step provides a general outline. The exact steps will vary depending on the platform you select.

    • Create a Latenode account and connect your Google Sheet.
    • Define your Google Sheet data as the source. Specify the “Ticker” column as the input for fetching the price data.
    • Add a new “Price” column to your Google Sheet.
    • Use Latenode’s workflow builder to create an automated process. You’ll configure the process to:
      • Fetch data from a cryptocurrency API using the ticker from your Google Sheet as a parameter.
      • Handle API responses correctly, mapping the API response’s “current_price” value to the corresponding row in your “Price” column.
      • Implement error handling to deal with API request failures.
    • Schedule the workflow to run automatically at regular intervals (e.g., every 5 minutes).

:mag: Common Pitfalls & What to Check Next:

  • API Key and Rate Limits: Ensure you have a valid API key for the cryptocurrency data provider you are using. Be mindful of API rate limits to avoid exceeding the allowed number of requests. The automation platform may help manage rate limits.
  • Ticker Symbol Consistency: Double-check that your ticker symbols in Google Sheets exactly match those accepted by the API. Case sensitivity is important (e.g., “BTC” vs. “btc”). Consider using a lookup table to map your ticker symbols to API-specific identifiers if needed.
  • Error Handling: Implement robust error handling in your automation workflow to gracefully manage situations like network errors or API downtime. This could involve retry mechanisms or setting default values for missing data.
  • Data Validation: Use Google Sheet’s built-in data validation to ensure that you enter only valid ticker symbols, thereby reducing the risk of invalid API requests.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

Yeah, dynamic cell referencing with concatenation works just like you showed. I run something similar for tracking assets and learned that handling API response delays is crucial. ImportJSON gets flaky during high volatility when everyone’s hammering the same endpoints. You could add INDIRECT references for more complex targeting, but what you have should work fine. One trick - set up conditional formatting to highlight cells that haven’t updated recently. Catches stale data fast. Your formula structure scales well once you nail down the ticker mapping.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.