# Fix GOOGLEFINANCE() #N/A Errors & Pull 10-Ks in Sheets

Why GOOGLEFINANCE() fails on London, Tokyo, India and S&P 500 tickers, and how to pull 67-country stock prices, SEC 10-K financials, and dividends in Sheets.

Anyone who has maintained a serious stock portfolio tracker, dividend calendar, or valuation workbook in Google Sheets eventually hits the same wall: you open your sheet on a Monday morning and half of your cells are stuck on `Loading...` or displaying `#N/A (When evaluating GOOGLEFINANCE, the query for the symbol returned no data)`.

Even when `=GOOGLEFINANCE()` does resolve, its data ceiling is painfully low. It only knows basic price, volume, market cap, and trailing P/E. It cannot pull a single line of an SEC Form 10-K income statement, quarterly free cash flow, share-count buyback history, ex-dividend schedules, or ETF constituent weights. And if you hold international equities in London (`.L`), Tokyo (`.T`), Toronto (`.TO`), Mumbai (`.NS`), Frankfurt (`.DE`), or Sydney (`.AX`), ticker resolution breaks constantly or mixes British pence (`GBp`) with pounds (`GBP`).

In this guide, we will break down exactly why `=GOOGLEFINANCE()` fails under real portfolio workloads, how to replace hundreds of volatile cell formulas with a single deterministic table pull, and how to add a 30-line `=QUANTSET()` custom function to Google Sheets that unlocks **90,000+ symbols across 67 countries**, **36,000+ companies with standardized financial statements**, **127M+ SEC EDGAR XBRL facts**, and **4,899 ETFs you can look through**.

---

## Why `=GOOGLEFINANCE()` Breaks on Real Portfolios

Before replacing your formulas, it helps to understand the four structural bottlenecks inside Google Sheets' built-in finance function:

1. **Per-Cell Evaluation Throttling (`Loading...` & `#N/A`):**
   In a typical 30-stock watchlist where you track 8 columns per ticker (Price, 1-Day Change %, 52-Week High, Market Cap, P/E, EPS, Beta, Volume), a traditional sheet executes **240 separate `=GOOGLEFINANCE()` calls**. Google throttles concurrent external evaluations per workbook; once you cross roughly 40 to 60 active cells, random cells time out and flip to `#N/A`.
2. **Broken International & Index Routing (`LON:`, `TYO:`, `NSE:`, `SPX`):**
   Google Finance relies on undocumented exchange prefixes that frequently drop historical date ranges. Queries for the S&P 500 index (`INDEXSP:.INX`), London Stock Exchange listings (`LON:SHEL`), Tokyo listings (`TYO:7203`), or National Stock Exchange of India symbols (`NSE:RELIANCE`) regularly fail when requesting historical bars—or silently quote London stocks in pence (`GBp`) without flagging the `100x` currency unit difference against USD or EUR positions.
3. **Zero Financial Statements, Cash Flows, or Balance Sheets:**
   You cannot build a Discounted Cash Flow (DCF) model, calculate Return on Invested Capital (`ROIC`), check Enterprise Value to Free Cash Flow (`EV/FCF`), or audit Stock-Based Compensation (`SBC`) dilution with `=GOOGLEFINANCE()`. It simply does not index SEC EDGAR filings.
4. **No Dividend History or Common-Stock Dividend Yield:**
   Surprisingly, `=GOOGLEFINANCE("AAPL", "yieldpct")` only works on mutual funds and returns `#N/A` on common stocks. You cannot pull ex-dividend dates, quarterly payout amounts, or dividend growth streaks.

---

## Why "Internet Workarounds" (`IFERROR`, Yahoo HTML Scraping & `IMPORTXML`) All Fail Too

Before you waste a Saturday trying the standard Reddit and StackOverflow "fixes" for `=GOOGLEFINANCE()`, here is why none of them survive more than a week in production:

- **The `IFERROR(GOOGLEFINANCE(...))` Retry Trick:** Wrapping formulas in `IFERROR()` or dummy checkbox toggles does not bypass Google's backend evaluation quota—it simply hides the `#N/A` error behind a blank or stale cell while your portfolio total quietly understates your net worth.
- **Scraping Yahoo Finance or Finviz With `=IMPORTHTML()` / `=IMPORTXML()`:** Both Yahoo Finance and Finviz render financial tables behind JavaScript hydration and aggressive datacenter bot-blocking (`HTTP 403` / `429` against Google's proxy IPs). Even if an XPath works on Tuesday, one CSS class change breaks every tab in your workbook.
- **Google Finance Will Never Add 10-K Statements, Segments, or ETF Holdings:** These aren't temporary bugs waiting on a patch—Google Finance is a retail price widget, not a financial statement or regulatory filing database.

The only permanent fix is to stop asking a brittle cell widget to scrape 250 individual cells, and instead **pull pre-reconciled market and SEC filing tables directly from an API built for spreadsheets and code**.

---

## The Permanent Fix: Replace 200 Brittle Cells With 1 QuantSet Table (`mw_demo` Free)

Every QuantSet data endpoint supports flat, header-labeled UTF-8 CSV output when you append `format=csv`. Instead of writing one formula per cell, **one `=IMPORTDATA()` formula in cell `A1` populates up to 100 tickers and every metric column in a single HTTP request**.

You can test every formula below right now with **zero signup** using the built-in `mw_demo` sandbox key (which covers 9 flagship global, ETF, crypto, and index listings: `us:NVDA`, `us:AAPL`, `us:MSFT`, `us:IVV`, `global:SHEL.L`, `global:1301.T`, `global:RELIANCE.NS`, `crypto:BTCUSDT`, and `index:SPX`).

### 1. Multi-Country & Crypto Portfolio Quotes in One Cell

Paste this formula into cell `A1` of a blank Google Sheet:

```excel
=IMPORTDATA("{{public_base}}/api/v1/quotes?tickers=us:NVDA,us:AAPL,us:MSFT,global:SHEL.L,global:1301.T,global:RELIANCE.NS,crypto:BTCUSDT&format=csv&apikey=mw_demo")
```

In under a second, Google Sheets expands a clean table containing `instrument_id`, `symbol`, `name`, `exchange`, `quote_currency` (explicitly distinguishing `USD`, `GBp`, `JPY`, `INR`, and `USDT`), `price`, `change_1d_pct`, `volume`, `market_cap_b`, and `pe_ttm`.

| Advantage | `=GOOGLEFINANCE()` | QuantSet `=IMPORTDATA()` CSV |
| --- | --- | --- |
| **HTTP Calls for 50 Stocks × 10 Columns** | 500 separate cell evaluations | **1 batch request** (`tickers=A,B,C...`) |
| **Global Market Coverage** | Frequent `#N/A` outside US | **90,000+ symbols across 67 countries + 734 crypto pairs** |
| **Currency & Pence (`GBp`) Precision** | Undocumented unit jumps | Explicit `quote_currency` (`GBp`, `JPY`, `INR`, `EUR`, `USD`) |
| **S&P 500 (`index:SPX`) History** | Broken on historical ranges | Full daily OHLCV back to **1927** |

### 2. Pull Multi-Year SEC 10-K & Discrete 10-Q Statements Into Your Sheet

Stop typing revenue, operating income, capital expenditures, and diluted share counts by hand from 10-K PDFs. Drop these three formulas into separate tabs of your valuation workbook:

**Tab 1 — 5-Year Annual Income Statement (`10-K`):**
```excel
=IMPORTDATA("{{public_base}}/api/v1/financial-statements/income?tickers=us:NVDA&period=annual&limit_per_instrument=5&format=csv&apikey=mw_demo")
```

**Tab 2 — 8 Quarters of Discrete Cash Flows (`10-Q` & `10-K`):**
```excel
=IMPORTDATA("{{public_base}}/api/v1/financial-statements/cash_flow?tickers=us:NVDA&period=quarterly&limit_per_instrument=8&format=csv&apikey=mw_demo")
```

**Tab 3 — Quarterly Balance Sheet (Cash, Total Debt & Shares):**
```excel
=IMPORTDATA("{{public_base}}/api/v1/financial-statements/balance_sheet?tickers=us:NVDA&period=quarterly&limit_per_instrument=4&format=csv&apikey=mw_demo")
```

Notice a critical accounting detail on Tab 2: SEC Form 10-Q filings report cash flows on a cumulative Year-to-Date (YTD) basis (6-month Q2 and 9-month Q3). Raw EDGAR scrapers dump cumulative 9-month cash flow into Q3, inflating your Q3 Free Cash Flow by `3x`. QuantSet automatically subtracts prior quarters within the fiscal year (`period_basis: "discrete_quarter"`) so every column in your spreadsheet is a true 3-month quarter, complete with the SEC `form`, `accession`, and public filing date (`available_at`).

### 3. Fix Missing Dividend History, Splits & S&P 500 Benchmark Prices

Need historical cash dividends (ex-date, payment date, amount per share) or daily S&P 500 benchmark closes?

```excel
=IMPORTDATA("{{public_base}}/api/v1/dividends?ticker=us:NVDA&limit=20&format=csv&apikey=mw_demo")
```

```excel
=IMPORTDATA("{{public_base}}/api/v1/prices?ticker=index:SPX&limit=252&format=csv&apikey=mw_demo")
```

---

## Method 2: Add the Native `=QUANTSET()` Formula to Google Sheets (30-Second Setup)

While `=IMPORTDATA()` is great for quick tables, experienced financial modelers prefer a short custom formula like `=QUANTSET("income", "NVDA", "period=annual")` for two reasons:

1. **Cleaner formulas:** You don't have to repeat `https://api.quantset.dev/api/v1/...` in every tab.
2. **One central API key cell (`Config!B1`):** If you share your sheet or upgrade from `mw_demo` to your personal `qsk_...` key, you paste your key once into cell `Config!B1` (or Script Properties) and every formula in your entire workbook updates automatically.

### Copy-Paste Apps Script (`Extensions → Apps Script`)

In your Google Sheet, click **Extensions → Apps Script**, replace any code in `Code.gs` with the 35 lines below, and press **Save (`Ctrl+S` / `Cmd+S`)**:

```javascript
/**
 * Query QuantSet 67-country stock prices, SEC 10-K/10-Q statements, 4,899 ETFs & 40-factor screens.
 *
 * Examples:
 *   =QUANTSET("quotes", "us:NVDA,us:AAPL,global:SHEL.L,global:1301.T,crypto:BTCUSDT")
 *   =QUANTSET("income", "us:NVDA", "period=annual&limit_per_instrument=5")
 *   =QUANTSET("cash-flow", "us:NVDA", "period=quarterly&limit_per_instrument=8")
 *   =QUANTSET("etf-holdings", "us:IVV", "limit=25")
 *   =QUANTSET("screener", "", "min_roic=20&max_pe_ttm=25&limit=25")
 *
 * @param {string} dataset Dataset slug ("quotes", "prices", "snapshots", "income", "balance-sheet", "cash-flow", "etf-holdings", "etf-exposures", "screener", "dividends", "estimates", "treasury-yields", "fx-rates").
 * @param {string=} tickers Optional ticker or comma-separated list ("NVDA" or "us:NVDA,global:SHEL.L").
 * @param {string=} extraQuery Optional query parameters ("period=quarterly&limit_per_instrument=4").
 * @return {Array<Array<string>>} 2D table of headers and values.
 * @customfunction
 */
function QUANTSET(dataset, tickers, extraQuery) {
  var routes = {
    "quotes": "/api/v1/quotes",
    "prices": "/api/v1/prices",
    "snapshots": "/api/v1/snapshots",
    "income": "/api/v1/financial-statements/income",
    "balance-sheet": "/api/v1/financial-statements/balance_sheet",
    "cash-flow": "/api/v1/financial-statements/cash_flow",
    "etf-holdings": "/api/v1/etf-holdings",
    "etf-exposures": "/api/v1/etf-exposures",
    "screener": "/api/v1/screener",
    "dividends": "/api/v1/dividends",
    "estimates": "/api/v1/estimates",
    "insider-activity": "/api/v1/insider-activity",
    "institutional-ownership": "/api/v1/institutional-ownership",
    "treasury-yields": "/api/v1/macro/treasury-yields",
    "fx-rates": "/api/v1/fx/rates"
  };
  var clean = String(dataset || "quotes").trim();
  var path = routes[clean] || ("/api/v1/" + clean.replace(/^\/+/, ""));
  var key = PropertiesService.getScriptProperties().getProperty("QUANTSET_API_KEY") || "mw_demo";
  try {
    var cfg = SpreadsheetApp.getActiveSpreadsheet().getRange("Config!B1").getValue();
    if (cfg && String(cfg).trim()) key = String(cfg).trim();
  } catch (e) {}

  var params = ["format=csv"];
  if (tickers && String(tickers).trim()) {
    var t = String(tickers).trim();
    var paramName = (path.indexOf("/quotes") !== -1 || path.indexOf("/financial-statements/") !== -1 || path.indexOf("/fundamentals") !== -1) ? "tickers" : "ticker";
    params.push(paramName + "=" + encodeURIComponent(t));
  }
  if (extraQuery && String(extraQuery).trim()) {
    params.push(String(extraQuery).trim().replace(/^[?&]+/, ""));
  }

  var url = "{{public_base}}" + path + "?" + params.join("&");
  var res = UrlFetchApp.fetch(url, { headers: { "X-API-Key": key }, muteHttpExceptions: true });
  if (res.getResponseCode() !== 200) {
    return [["QuantSet HTTP " + res.getResponseCode(), res.getContentText().slice(0, 240)]];
  }
  return Utilities.parseCsv(res.getContentText());
}
```

### Five High-Leverage `=QUANTSET()` Formulas to Try Right Now

Once saved, type any of these formulas into a cell:

1. **Global Portfolio Watchlist (US, London, Tokyo, Mumbai & Crypto):**
   `=QUANTSET("quotes", "us:NVDA,us:AAPL,global:SHEL.L,global:1301.T,global:RELIANCE.NS,crypto:BTCUSDT")`
2. ** Valuation Snapshot (EV/EBITDA, EV/FCF, ROIC, Gross/Net Margins, 52W Range):**
   `=QUANTSET("snapshots", "us:NVDA")`
3. **ETF Look-Through Holdings (`4,899` Funds from SEC Form N-PORT):**
   `=QUANTSET("etf-holdings", "us:IVV", "limit=25")`
4. **Reverse Stock-to-ETF Exposure (*"Which ETFs have the largest weight in NVDA?"*):**
   `=QUANTSET("etf-exposures", "us:NVDA", "limit=25")`
5. **40-Factor Quality & Buyback Stock Screener (Requires Personal Key in `Config!B1`):**
   `=QUANTSET("screener", "", "min_roic=20&max_pe_ttm=25&max_share_count_change_1y=-2&limit=25")`

---

## Converting Local Currency Positions (`GBp`, `JPY`, `INR`, `EUR`) to USD

When you track international stocks in London (`GBp`), Tokyo (`JPY`), or Mumbai (`INR`), every QuantSet quote and snapshot response includes both the native exchange price (`native_close` / `quote_currency`) and the FX-converted USD market capitalization (`market_cap_b`).

If you want a live FX conversion table inside your sheet covering **42 reference currencies**, add a dedicated `FX` tab using your personal API key:

```excel
=QUANTSET("fx-rates", "", "base_currency=USD&latest_only=true")
```

Because `GBp` (British pence) is `1/100` of `GBP` (British pounds), QuantSet labels London pence listings explicitly as `GBp` rather than `GBP`—eliminating the classic `100x` portfolio valuation bug that plagues `=GOOGLEFINANCE("LON:SHEL")` sheets.

### Exact Google Sheets `XLOOKUP` Formula for Multi-Currency Net Worth

Once you have a `Watchlist` tab (using `=QUANTSET("quotes", ...)`) and an `FX` tab (using `=QUANTSET("fx-rates", "", "base_currency=USD&latest_only=true")`), you can convert any holding's market value into US Dollars—including British pence (`GBp`)—with a single deterministic `IF` + `XLOOKUP` formula:

```excel
=LET(
  qty, B2,
  local_price, C2,
  ccy, D2,
  gross_local, IF(ccy = "GBp", (qty * local_price) / 100, qty * local_price),
  lookup_ccy, IF(ccy = "GBp", "GBP", IF(ccy = "USDT", "USD", ccy)),
  fx_per_usd, IF(lookup_ccy = "USD", 1, XLOOKUP(lookup_ccy, FX!B:B, FX!D:D, 1)),
  gross_local / fx_per_usd
)
```

Why this pattern never breaks:
- **Zero pence inflation:** When `quote_currency` (`D2`) is `"GBp"`, it divides the pence notional by `100` to convert into `GBP` before applying the `USD/GBP` exchange rate.
- **Crypto & USD passthrough:** Both `USD` equities and `USDT`-quoted spot crypto pairs map cleanly to `1.0` without throwing `#N/A` on missing FX rows.
- **Dated FX auditability:** Every row on the `FX` tab carries the exact ECB/reference observation date (`date`), so your quarter-end portfolio snapshot is reproducible down to the cent.

---

## Method 3: Scheduled Overnight Sheet Refresh (Eliminating Formula Recalculation Limits)

Even with batch `=IMPORTDATA()` or `=QUANTSET()` formulas, Google Sheets recalculates custom functions and external URLs whenever a sheet reopens after cache expiry. If you run a large fund dashboard—say **250 global positions, 5 years of quarterly income statements, and 3 ETF look-through tabs**—writing static values into dedicated data tabs on a scheduled **Time-Driven Apps Script Trigger** makes your workbook open in **0.1 seconds** on mobile and desktop, and ensures zero formula flicker while markets are closed.

Add this 28-line scheduled loader right below `QUANTSET()` in your `Extensions → Apps Script` editor:

```javascript
/**
 * Scheduled writer: fetches CSV rows from QuantSet once per day (or hour)
 * and writes static typed values into a target sheet tab.
 */
function refreshPortfolioTabs() {
  var key = PropertiesService.getScriptProperties().getProperty("QUANTSET_API_KEY") || "mw_demo";
  var jobs = [
    {
      tab: "Data_Quotes",
      url: "{{public_base}}/api/v1/quotes?tickers=us:NVDA,us:AAPL,us:MSFT,global:SHEL.L,global:1301.T,global:RELIANCE.NS,crypto:BTCUSDT&format=csv"
    },
    {
      tab: "Data_NVDA_Income",
      url: "{{public_base}}/api/v1/financial-statements/income?tickers=us:NVDA&period=annual&limit_per_instrument=5&format=csv"
    },
    {
      tab: "Data_IVV_Holdings",
      url: "{{public_base}}/api/v1/etf-holdings?ticker=us:IVV&limit=50&format=csv"
    }
  ];

  var book = SpreadsheetApp.getActiveSpreadsheet();
  jobs.forEach(function(job) {
    var response = UrlFetchApp.fetch(job.url, {
      headers: { "X-API-Key": key },
      muteHttpExceptions: true
    });
    if (response.getResponseCode() !== 200) {
      Logger.log("Skipped " + job.tab + ": HTTP " + response.getResponseCode());
      return;
    }
    var rows = Utilities.parseCsv(response.getContentText());
    if (!rows || !rows.length) return;
    var sheet = book.getSheetByName(job.tab) || book.insertSheet(job.tab);
    sheet.clearContents();
    sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows);
  });
}
```

To automate it:
1. In the Apps Script left sidebar, click **Triggers** (the alarm-clock icon) → **Add Trigger**.
2. Choose `refreshPortfolioTabs`, event source **Time-driven**, type **Day timer**, and select **5pm to 6pm** (right after US market close).
3. Your dashboard formulas (`XLOOKUP`, `INDEX/MATCH`, sparklines, and charts) now read from local `Data_*` tabs—zero `Loading...` spinners, zero `#N/A` errors, and predictable credit usage of just 3 requests per day.

---

## Upgrading Your Sheet From Sample Tickers (`mw_demo`) to All 90,000+ Global Symbols

Every formula above runs immediately with `mw_demo` so you can verify the exact columns, speed, and currency formatting on `us:NVDA`, `us:AAPL`, `us:MSFT`, `us:IVV`, `global:SHEL.L`, `global:1301.T`, `global:RELIANCE.NS`, `crypto:BTCUSDT`, and `index:SPX` before creating an account.

The moment you type your own portfolio tickers—whether that is `PLTR`, `COST`, `ASML`, `7203.T`, `CSU.TO`, or a 40-factor screen—you unlock the entire **90,000+ symbol warehouse across 67 countries** in two steps:

1. Claim a free personal key at **[quantset.dev/signup](/signup)** (**250 free credits** included immediately, no credit card required).
2. Paste your `qsk_...` key into cell **`Config!B1`** (or **Apps Script → Project Settings → Script Properties** under `QUANTSET_API_KEY`).

Every `=QUANTSET()` and `Config!B1`-linked `=IMPORTDATA()` tab in your workbook switches from the 9-ticker sandbox to full global coverage in under a second—without rewriting a single formula.

| Symptom When Moving to Live Portfolios | Why It Happens | Instant Fix in QuantSet |
| --- | --- | --- |
| **`HTTP 403` when typing a non-sample ticker (e.g. `PLTR` or `7203.T`)** | `mw_demo` is scoped to the 9 zero-signup benchmark symbols | Paste your free `qsk_...` key (`250 free credits` at [quantset.dev/signup](/signup)) into `Config!B1` |
| **`#REF! Array result was not expanded because it would overwrite data`** | Non-empty cells exist below or to the right of `A1` | Put each `=QUANTSET()` import on its own clean `Data_*` tab and pull values into your dashboard via `XLOOKUP` |
| **Ticker collision (`BTC` or `RIO`) returns `HTTP 422`** | Bare symbol exists across multiple markets (`us:BTC` ETF vs `crypto:BTCUSDT`) | Use canonical IDs (`us:NVDA`, `global:SHEL.L`, `crypto:BTCUSDT`, `index:SPX`)—see [Instrument IDs](/docs/guides/instrument-ids) |
| **Sharing a Google Sheet publicly with clients or subscribers** | `=IMPORTDATA("...?apikey=qsk_...")` shows the URL in the formula bar | Store `QUANTSET_API_KEY` in **Script Properties** and use `=QUANTSET()` or `refreshPortfolioTabs()` so your key stays private |

---

## Frequently Asked Questions

### Why does `=GOOGLEFINANCE()` say *"When evaluating GOOGLEFINANCE, the query for the symbol returned no data"*?
Google Finance's backend drops requests when an exchange ticker changes routing, when historical date windows hit an unindexed international venue (common on `LON:`, `TYO:`, `TSE:`, and `ASX:`), or when your sheet exceeds Google's undocumented per-workbook concurrent formula throttle. Replacing cell-by-cell calls with a single batch CSV request (`/api/v1/quotes?tickers=...&format=csv`) eliminates per-cell throttling completely.

### Can I pull 10 years of SEC 10-K financials and quarterly 10-Q statements into Google Sheets for free?
Yes. You can test 5-year and 10-year statements, daily OHLCV prices, dividends, and ETF holdings immediately with zero signup using `apikey=mw_demo` on the nine sample instruments (`us:NVDA`, `us:AAPL`, `us:MSFT`, `us:IVV`, `global:SHEL.L`, `global:1301.T`, `global:RELIANCE.NS`, `crypto:BTCUSDT`, `index:SPX`). Signing in at [quantset.dev/signup](/signup) grants **250 free credits** (no credit card required) across all **90,000+ symbols and 36,000+ standardized financial-statement issuers**.

### How often does `=IMPORTDATA()` refresh in Google Sheets?
Google Sheets caches `=IMPORTDATA()` URLs on Google's proxy servers for roughly 15 to 60 minutes. If you want deterministic refresh timing—such as every morning at 8:00 AM London time or 4:15 PM New York time—use the `refreshPortfolioTabs()` Apps Script trigger above, which fetches directly from `{{public_base}}` on your exact schedule.

### Does the same CSV URL work in Microsoft Excel and Python?
Yes. Every QuantSet URL works identically in Google Sheets (`=IMPORTDATA()`), Microsoft Excel (**Data → From Web / Power Query**), Python (`pd.read_csv()` or `pip install quantset`), and AI coding assistants via the [QuantSet MCP Server](/docs/agents). See the full [Global Markets guide](/docs/global-markets) and our [Spreadsheets & Notion Templates Playbook](/docs/guides/google-sheets-excel-notion-stock-templates) for ready-to-copy templates.
