Financial Statements in Google Sheets and Excel
QuickFS shut down in February 2026, and its =QFS() add-in for Excel and Google Sheets stopped working with it. This guide shows a free way to pull 10+ years of income statement, balance sheet and cash flow data into a spreadsheet again: a =QL() formula for Google Sheets and a ready-made Power Query for Excel, both reading the free Quotelinks SEC Fundamentals API. No add-in to install and no sign-up.
- Google Sheets formula
- Excel Power Query
- Annual, quarterly & TTM
- Data back to 2009
- No sign-up
Personal, non-commercial use only. Redistribution of the data is not allowed. See the Terms of Service.
What you get
The data comes from the financial statements companies file with the SEC, standardized into 39 fields: revenue, gross profit, operating and net income, EPS, cash, debt, equity, operating cash flow, capital expenditures, free cash flow, dividends, buybacks and more. Annual and quarterly figures go back to 2009, plus trailing twelve months (TTM), for more than 17,000 companies, looked up by ticker or CIK.
| You want to | Use |
|---|---|
| Pull single figures or 10-year rows into your own model | Google Sheets: =QL() |
| Get a whole statement table in one go | Google Sheets: =QL_STATEMENT(), or Excel Power Query |
| Just look at a company's numbers | The statement pages, e.g. Apple income statement, balance sheet, cash flow and ratios |
Google Sheets setup (2 minutes)
Prefer not to paste code? The free Quotelinks SEC Fundamentals add-on for Google Sheets gives you the same =QL() formulas, plus QL_STATEMENT() and a sidebar that inserts whole statements.
- Open your spreadsheet and choose Extensions › Apps Script.
- Delete the sample code, paste the script below and click Save (the disk icon).
- Go back to the sheet and type
=QL("AAPL", "revenue")in any cell.
/**
* Quotelinks financial statements for Google Sheets
* https://www.quotelinks.com/api/sec-fundamentals/google-sheets-excel.html
*
* =QL("AAPL", "revenue") latest fiscal year
* =QL("AAPL", "revenue", "FY-9:FY") last 10 fiscal years, oldest first
* =QL("MSFT", "fcf", "FQ-3:FQ") last 4 quarters
* =QL("NVDA", "eps_diluted", "TTM") trailing twelve months
* =QL_STATEMENT("AAPL") full statement table (last 10 years)
*
* Data: Quotelinks SEC Fundamentals API (from SEC EDGAR filings).
* Personal, non-commercial use only: https://www.quotelinks.com/tos.html
*/
var QL_API = "https://api.quotelinks.com/v1/financials/";
var QL_API_TOKEN = ""; // optional free key from https://www.quotelinks.com/api/key/
var QL_CACHE_SECONDS = 21600; // 6 hours; the data changes once a day
/**
* Returns one financial figure, or a row of figures, for a company.
*
* @param {string} symbol Ticker or SEC CIK, e.g. "AAPL".
* @param {string} field Field name, e.g. "revenue", "net_income", "fcf", "eps_diluted", "fiscal_year".
* @param {string} period "FY" (default), "FY-1", "FY-9:FY", "FQ", "FQ-3:FQ", "TTM", "TTM-4:TTM" or a fiscal year such as 2023.
* @return The value, or a row of values from oldest to newest.
* @customfunction
*/
function QL(symbol, field, period) {
if (!symbol) throw new Error("Enter a ticker, e.g. \"AAPL\"");
if (!field) throw new Error("Enter a field, e.g. \"revenue\"");
var p = qlParsePeriod_(period);
var data = qlLoad_(symbol, p.kind);
var col = qlColumn_(data, String(field).trim().toLowerCase());
if (p.year !== null) {
for (var i = 0; i < data.rows.length; i++) {
if (data.rows[i][0] === p.year) return qlValue_(data.rows[i][col]);
}
return "";
}
var picked = qlPick_(data.rows, p.from, p.to);
if (picked.single) return qlValue_(picked.rows[0] ? picked.rows[0][col] : null);
return [picked.rows.map(function (r) { return qlValue_(r[col]); })];
}
/**
* Returns a whole statement: one row per field, one column per period (oldest first).
*
* @param {string} symbol Ticker or SEC CIK, e.g. "AAPL".
* @param {string} period "FY" (default), "FQ" or "TTM".
* @param {number} count How many periods (default 10).
* @return A table with a header row.
* @customfunction
*/
function QL_STATEMENT(symbol, period, count) {
if (!symbol) throw new Error("Enter a ticker, e.g. \"AAPL\"");
var p = qlParsePeriod_(period || "FY");
var n = Math.max(1, Math.min(80, Math.floor(Number(count) || 10)));
var data = qlLoad_(symbol, p.kind);
var rows = data.rows.slice(0, n).reverse(); // oldest first
var head = ["Field"].concat(rows.map(function (r) {
return r[1] === "FY" ? "FY" + r[0] : r[0] + " " + r[1];
}));
var out = [head];
for (var c = 4; c < data.cols.length; c++) {
out.push([data.cols[c]].concat(rows.map(function (r) { return qlValue_(r[c]); })));
}
return out;
}
// ---- helpers ------------------------------------------------------------
function qlParsePeriod_(period) {
var s = String(period === undefined || period === null || period === "" ? "FY" : period).trim().toUpperCase();
if (/^\d{4}$/.test(s)) return { kind: "annual", from: 0, to: 0, year: Number(s) };
var m = s.match(/^(FY|FQ|TTM)(?:-(\d+))?(?::(FY|FQ|TTM)(?:-(\d+))?)?$/);
if (!m || (m[3] && m[3] !== m[1])) throw new Error("Bad period \"" + period + "\". Use FY, FY-1, FY-9:FY, FQ, FQ-3:FQ, TTM or a year.");
var kind = { FY: "annual", FQ: "quarterly", TTM: "ttm" }[m[1]];
var a = Number(m[2] || 0);
if (!m[3]) return { kind: kind, from: a, to: a, year: null };
var b = Number(m[4] || 0);
return { kind: kind, from: Math.max(a, b), to: Math.min(a, b), year: null };
}
// rows are newest first; offsets count back from the newest (0 = latest)
function qlPick_(rows, from, to) {
if (from === to) return { single: true, rows: [rows[from]] };
return { single: false, rows: rows.slice(to, from + 1).reverse() };
}
function qlColumn_(data, field) {
var i = data.cols.indexOf(field);
if (i < 0) throw new Error("Unknown field \"" + field + "\". Try revenue, net_income, fcf, eps_diluted, total_assets or fiscal_year.");
return i;
}
function qlValue_(v) {
return v === null || v === undefined ? "" : v;
}
// Downloads the statements once and keeps a compact copy in the cache:
// cols = [fiscal_year, fiscal_period, end, form, ...39 fields], rows newest first.
function qlLoad_(symbol, kind) {
var id = String(symbol).trim().toUpperCase();
var key = "ql1|" + id + "|" + kind;
var cache = CacheService.getScriptCache();
var hit = cache.get(key);
if (hit) return JSON.parse(hit);
var url = QL_API + encodeURIComponent(id) + "?period=" + kind + (QL_API_TOKEN ? "&api_token=" + encodeURIComponent(QL_API_TOKEN) : "");
var res = null;
for (var attempt = 0; attempt < 3; attempt++) {
res = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
if (res.getResponseCode() !== 429) break;
Utilities.sleep(1200 * (attempt + 1));
}
var code = res.getResponseCode();
var body = res.getContentText();
if (code !== 200) {
var msg = "HTTP " + code;
try { msg = JSON.parse(body).message || msg; } catch (e) {}
throw new Error(msg);
}
var json = JSON.parse(body);
var fields = Object.keys(json.fields);
var cols = ["fiscal_year", "fiscal_period", "end", "form"].concat(fields);
var rows = json.periods.map(function (p) {
return cols.map(function (c) { return p[c] === undefined ? null : p[c]; });
});
var data = { cols: cols, rows: rows };
try { cache.put(key, JSON.stringify(data), QL_CACHE_SECONDS); } catch (e) {} // over 100 KB: just skip caching
return data;
}The script adds two functions, QL and QL_STATEMENT, to that spreadsheet only. It keeps each download in Google's cache for 6 hours, so a sheet full of formulas for the same company makes one request, not hundreds.
Formula examples
FNQL(symbol, field, [period])
| Formula | Returns |
|---|---|
=QL("AAPL", "revenue") | Revenue of the latest fiscal year |
=QL("AAPL", "net_income", "FY-1") | Net income one fiscal year earlier |
=QL("AAPL", "revenue", "FY-9:FY") | The last 10 fiscal years in one row, oldest first |
=QL("AAPL", "fiscal_year", "FY-9:FY") | The matching row of years, for a header |
=QL("AAPL", "revenue", 2023) | Revenue of fiscal year 2023 |
=QL("MSFT", "fcf", "FQ-3:FQ") | Free cash flow of the last 4 quarters |
=QL("NVDA", "eps_diluted", "TTM") | Diluted EPS over the trailing twelve months |
=QL(A2, "total_assets") | Works with a ticker in another cell |
Periods: FY is the latest fiscal year, FQ the latest quarter, TTM the latest trailing twelve months. Add -n to go back n periods, and use a range like FY-9:FY to get several periods at once. A four-digit number picks that fiscal year. Fiscal years are labelled the way the company labels them.
FNQL_STATEMENT(symbol, [period], [count])
| Formula | Returns |
|---|---|
=QL_STATEMENT("AAPL") | All 39 fields for the last 10 fiscal years, with a header row |
=QL_STATEMENT("MSFT", "FQ", 8) | The last 8 quarters |
=QL_STATEMENT("NVDA", "TTM", 4) | Trailing twelve months at the last 4 quarter ends |
Amounts are in full units of the company's reporting currency (not thousands or millions). To show billions, divide in the formula, e.g. =QL("AAPL","revenue")/1e9. Empty cells mean the company did not report that item.
Excel: Power Query
Want formulas instead of a query? The free Quotelinks Excel add-in adds =QL.FIN() and related functions in Excel for Microsoft 365 on Windows and Mac and in Excel on the web.
Excel has no built-in formula that reads JSON from the web, but Power Query (in Excel for Microsoft 365 on Windows) loads a whole statement as a table you can refresh.
- Choose Data › Get Data › From Other Sources › Blank Query.
- In the Power Query editor, choose Home › Advanced Editor, replace everything with the query below and click Done.
- If Excel asks how to connect to the web content, pick Anonymous and Connect.
- Choose Home › Close & Load. The statement lands on a new sheet: one row per field, one column per period.
let
Ticker = "AAPL", // ticker or SEC CIK
Period = "annual", // "annual", "quarterly" or "ttm"
Count = 10, // how many periods
Source = Json.Document(Web.Contents("https://api.quotelinks.com/v1/financials/",
[RelativePath = Ticker, Query = [period = Period]])),
Fields = Record.FieldNames(Source[fields]),
Periods = List.Reverse(List.FirstN(Source[periods], Count)), // oldest first
Labels = List.Transform(Periods, each
if [fiscal_period] = "FY" then "FY" & Text.From([fiscal_year])
else Text.From([fiscal_year]) & " " & [fiscal_period]),
Rows = List.Transform(Fields, (f) =>
{f} & List.Transform(Periods, (p) => Record.FieldOrDefault(p, f, null))),
Result = Table.FromRows(Rows, {"Field"} & Labels)
in
ResultTo switch companies, change Ticker on the first line (Power Query editor › Advanced Editor), or duplicate the query once per company. Data › Refresh All loads the latest figures; the data changes once a day, so there is no need to refresh more often.
Field names
Use these names in QL(). The full definitions are in the API field reference.
| Statement | Fields |
|---|---|
| Income statement | revenue cost_of_revenue gross_profit rnd sga operating_expenses operating_income interest_expense pretax_income income_tax net_income net_income_common eps_basic eps_diluted shares_basic shares_diluted dps |
| Balance sheet | cash st_investments receivables inventory current_assets ppe_net goodwill intangibles total_assets accounts_payable current_liabilities long_term_debt total_liabilities equity shares_outstanding |
| Cash flow | cfo capex fcf dividends_paid buybacks sbc dna |
| Period info | fiscal_year fiscal_period end form |
Ratios and margins
The API returns reported figures; ratios are one formula away:
| Ratio | Google Sheets formula |
|---|---|
| Gross margin | =QL("AAPL","gross_profit")/QL("AAPL","revenue") |
| Operating margin | =QL("AAPL","operating_income")/QL("AAPL","revenue") |
| FCF margin | =QL("AAPL","fcf")/QL("AAPL","revenue") |
| Return on equity | =QL("AAPL","net_income")/QL("AAPL","equity") |
| 10-year revenue CAGR | =(QL("AAPL","revenue")/QL("AAPL","revenue","FY-10"))^(1/10)-1 |
Format the cells as percentages. For ready-made ratios such as ROIC, margins and valuation multiples, see a company's key metrics page.
Limits & tips
- Fair use: up to 2 requests per second without a key. Thanks to the cache, that is plenty for a normal sheet. For large sheets, get a free API key (10 requests per second) and paste it into
QL_API_TOKENat the top of the script. - “Loading…” for a while? The first formula for a company downloads its full history; the rest come from the cache.
- #ERROR! Hover over the cell to see the message, e.g. an unknown ticker or field name.
- Fresh data: the API is rebuilt every night from SEC EDGAR, and a new 10-K or 10-Q appears the day after the SEC publishes it. The script cache lasts 6 hours.
- Check important numbers against the filing: the methodology explains how quarters, TTM and split adjustments are calculated.
Differences from QuickFS
- Function names differ:
=QL()uses its own field names (see above), so=QFS()formulas need to be rewritten. - Coverage: companies that file with the SEC, including foreign companies that file 20-F or 40-F reports (in their own currency). Stocks listed only outside the US are not included.
- History: from 2009, when companies began filing XBRL data with the SEC.
- Ratios: calculated in your sheet from the reported figures, as shown above.
- Cost: free, with no account needed.
Frequently asked questions
Is there a replacement for the QuickFS Excel and Google Sheets add-in?
Yes. QuickFS shut down in February 2026. The free =QL() function on this page pulls standardized annual, quarterly and TTM financial statements into Google Sheets, and the Power Query on this page loads them into Excel, both from the Quotelinks SEC Fundamentals API. The function and field names differ from =QFS(), so formulas need to be rewritten.
Is it free?
Yes, for personal, non-commercial use, with no sign-up. Fair use is up to 2 requests per second without a key, or 10 per second with a free API key. Redistribution of the data is not allowed.
Which companies are covered?
Companies that file financial statements with the U.S. Securities and Exchange Commission: more than 17,000 with standardized statements, including foreign companies that file 20-F or 40-F reports, in their reporting currency. Stocks listed only outside the US are not included.
How many years of data are available?
Annual and quarterly figures go back to 2009, when companies began filing XBRL data with the SEC, plus trailing twelve months at every quarter end.
Does it work in Excel for Mac or Excel Online?
The Power Query on this page is written for Excel for Microsoft 365 on Windows. On a Mac or in Excel on the web, use the free Quotelinks Excel add-in, which works in both, or the Google Sheets function.
Why does a cell show #ERROR?
Hover over the cell to see the message. Common causes are a ticker the SEC does not know, a misspelled field name, or a period that the company has not reported.