# Build an Automated SEC 10-K DCF Model in Sheets & Excel

How to pull reconciled SEC 10-K income statements, discrete 10-Q cash flows, balance sheet net debt, and live 10Y Treasury WACC into Sheets or Excel.

Every equity analyst knows the grind of building a Discounted Cash Flow (DCF) model from scratch. Before you can spend a single minute thinking about revenue drivers, operating leverage, or terminal multiples, you lose an hour copying five years of income statements, balance sheets, and cash flows out of SEC Form 10-K and Form 10-Q filings—then checking that diluted share counts, stock-based compensation (`SBC`), and debt footnotes actually tie out.

If you try to automate that step with free web scrapers or low-cost spreadsheet plugins, two quiet accounting bugs almost always corrupt your intrinsic value estimate:

1. **The Cumulative Year-to-Date (YTD) 10-Q Cash Flow Trap:**
   In SEC Form 10-Q filings, companies report the Income Statement for the 3-month quarter, **but report the Cash Flow Statement on a cumulative Year-to-Date basis** (6 months in Q2, 9 months in Q3). Most raw XBRL APIs dump the 9-month cumulative operating cash flow and capex into the Q3 column. If you sum the trailing four quarters (`Q4 + Q1 + Q2 + Q3`) to compute Trailing Twelve Month (`TTM`) Free Cash Flow, you double-count Q1 and Q2—inflating your DCF valuation by 40% to 80%.
2. **Missing Stock-Based Compensation (`SBC`) and Net Debt Bridges:**
   Technology and high-growth issuers routinely report high GAAP operating cash flow while issuing 3% to 6% of their market cap in annual stock-based compensation. Treating raw `Operating Cash Flow - CapEx` as distributable owner cash flow—without comparing it against `Owner FCF (FCF - SBC)` and actual 1-year diluted share-count creep—systematically overvalues dilutive companies.

In this playbook, we will build a **4-tab automated DCF workbook in Google Sheets or Excel** backed by **QuantSet's reconciled SEC EDGAR XBRL warehouse** (`36,000+` standardized companies, `127M+` SEC filing facts back to 2000, and live U.S. Treasury yield curves). Every formula works out of the box right now on sample tickers (`us:NVDA`, `us:AAPL`, `us:MSFT`) using the free `mw_demo` key, and unlocks all **90,000+ symbols across 67 countries** when you paste your personal key (`250 free credits` on signup, no credit card) into a single config cell.

---

## Architecture of the 4-Tab Automated DCF Workbook

To keep your spreadsheet fast, auditable, and easy to switch between tickers, structure your workbook into four raw data tabs feeding one `DCF_Model` summary tab:

| Tab Name | Cell `A1` Data Source | What It Feeds Into the DCF |
| --- | --- | --- |
| **`Config`** | `B1` = `mw_demo` (or your `qsk_...` key), `B2` = `us:NVDA` | Controls the active ticker and API key for the entire workbook |
| **`Income_5Y`** | `/api/v1/financial-statements/income` (`period=annual`) | 5-year revenue CAGR, gross margin, EBIT margin, effective tax rate, and diluted shares |
| **`CashFlow_8Q`** | `/api/v1/financial-statements/cash_flow` (`period=quarterly`) | Discrete 3-month Operating Cash Flow, CapEx, Free Cash Flow, and Stock-Based Compensation (`SBC`) |
| **`Balance_Latest`** | `/api/v1/financial-statements/balance_sheet` (`period=quarterly`) | Latest Cash & Short-Term Investments, Total Debt, and Net Debt for the EV-to-Equity bridge |
| **`Rates_Consensus`** | `/api/v1/macro/treasury-yields` + `/api/v1/estimates` | Live 10-Year U.S. Treasury risk-free rate ($R_f$) for WACC + Wall Street Year 1–2 revenue consensus |

---

## Step 1: Pull Reconciled 5-Year Annual Income Statements (`Income_5Y`)

In Google Sheets, create a tab named `Config`, put `mw_demo` in cell **`B1`**, and put `us:NVDA` in cell **`B2`**.

Now open your `Income_5Y` tab and paste this dynamic `=IMPORTDATA()` formula into cell **`A1`**:

```excel
=IMPORTDATA("{{public_base}}/api/v1/financial-statements/income?tickers="&Config!B2&"&period=annual&limit_per_instrument=5&format=csv&apikey="&Config!B1)
```

*(If you installed our 30-line `=QUANTSET()` custom function from the [Google Sheets, Excel & Notion Templates guide](/docs/guides/google-sheets-excel-notion-stock-templates), you can write this even more cleanly as `=QUANTSET("income", Config!B2, "period=annual&limit_per_instrument=5")`.)*

### What QuantSet Returns (And Why You Can Trust It)

Every row in `Income_5Y` includes:
- **Exact SEC Filing Provenance:** `period_end`, `fiscal_year`, `fiscal_period`, `form` (`10-K`), `accession` (the 18-digit SEC EDGAR accession number), and `available_at` (the exact date the filing became public).
- **Standardized Operating Lines:** `revenue`, `cost_of_revenue`, `gross_profit`, `research_and_development`, `selling_general_and_administrative`, `operating_income` (`EBIT`), `interest_expense`, `pretax_income`, `income_tax_expense`, `net_income`, `ebitda`, `basic_eps`, `diluted_eps`, and `diluted_shares`.
- **Strict Null Policy (`null` is never `0`):** When an issuer does not report an R&D line (for example, a retailer or bank), QuantSet returns an empty cell (`null`), never a fake `0` that distorts peer median ratios.

---

## Step 2: Pull Discrete Quarterly Cash Flows & Audit SBC (`CashFlow_8Q`)

Next, create the `CashFlow_8Q` tab and paste this formula into cell **`A1`**:

```excel
=IMPORTDATA("{{public_base}}/api/v1/financial-statements/cash_flow?tickers="&Config!B2&"&period=quarterly&limit_per_instrument=8&format=csv&apikey="&Config!B1)
```

Because QuantSet unrolls cumulative YTD 10-Q cash flows into **discrete 3-month quarters** (`period_basis: "discrete_quarter"`), you can compute **Trailing Twelve Month (`TTM`) Free Cash Flow** directly in your sheet by summing the top 4 rows (`SUM(D2:D5)`):

1. **Standard Unlevered / Levered Free Cash Flow:**
   $$\text{FCF}_{\text{TTM}} = \sum_{t=1}^{4} \left(\text{Operating Cash Flow}_t - |\text{Capital Expenditures}_t|\right)$$
2. **SBC-Adjusted "Owner" Free Cash Flow:**
   $$\text{Owner FCF}_{\text{TTM}} = \text{FCF}_{\text{TTM}} - \sum_{t=1}^{4} \text{Stock-Based Compensation}_t$$

> **Institutional Sanity Check:** Always display **both** standard FCF and SBC-adjusted Owner FCF in your DCF summary block. If `Stock-Based Compensation` exceeds 20% of Operating Cash Flow while diluted shares (`diluted_shares` on `Income_5Y`) are growing faster than 2% per year, discounting unadjusted FCF without accounting for ongoing equity dilution will overstate fair value per share.

---

## Step 3: Build the Enterprise Value to Equity Value Bridge (`Balance_Latest`)

A DCF discounts future unlevered cash flows to arrive at **Implied Enterprise Value (`EV`)**. To convert Implied Enterprise Value into **Implied Intrinsic Value per Share**, you need the latest balance sheet Net Debt and diluted share count.

In `Balance_Latest`, paste this formula into cell **`A1`**:

```excel
=IMPORTDATA("{{public_base}}/api/v1/financial-statements/balance_sheet?tickers="&Config!B2&"&period=quarterly&limit_per_instrument=4&format=csv&apikey="&Config!B1)
```

From row 2 (the most recent quarter), wire your Equity Value bridge:

$$\text{Implied Equity Value} = \text{Implied Enterprise Value} + \text{Cash \& Short-Term Investments} - \text{Total Debt}$$

$$\text{Intrinsic Value per Share} = \frac{\text{Implied Equity Value}}{\text{Diluted Shares Outstanding}}$$

Want to verify whether a company has a hidden refinancing wall in the next 24 months? You can also pull its SEC footnote debt maturity schedule directly into a side tab via `=IMPORTDATA("{{public_base}}/api/v1/debt-maturities?ticker="&Config!B2&"&format=csv&apikey="&Config!B1)`.

---

## Step 4: Anchor WACC to the Live 10-Year U.S. Treasury Yield & Consensus Estimates

Hardcoding a `4.00%` risk-free rate ($R_f$) or guessing Year 1 revenue growth makes a spreadsheet go stale the week after you build it. Instead, pull the **live U.S. Treasury Par Yield Curve** (`1M` through `30Y` plus TIPS real yields) and **Wall Street Forward Consensus Estimates** into your `Rates_Consensus` tab:

**Cell `A1` — Wall Street Consensus Revenue & EPS Estimates:**
```excel
=IMPORTDATA("{{public_base}}/api/v1/estimates?ticker="&Config!B2&"&metric=revenue&format=csv&apikey="&Config!B1)
```

**Cell `A15` — Live Daily U.S. Treasury Yield Curve (Personal Key):**
```excel
=IMPORTDATA("{{public_base}}/api/v1/macro/treasury-yields?limit=5&format=csv&apikey="&Config!B1)
```

From those two tables:
- Link your DCF's **Risk-Free Rate ($R_f$)** cell directly to the `y10` (10-Year Treasury Yield) column.
- Compare your Year 1–2 projected revenue growth against the mean analyst consensus estimate (`mean_estimate`, `low_estimate`, `high_estimate`, and `num_analysts`) so you can immediately see whether your Base Case is above or below Street expectations.

---

## Step 5: Loading the Exact Same DCF Model in Microsoft Excel (Power Query)

If you build your models in **Microsoft Excel** on Windows or Mac, you don't need any third-party `.xlam` add-in. Excel's built-in **Power Query** loads QuantSet CSV endpoints straight into native Excel Tables that refresh whenever you press **`Ctrl+Alt+F5`**.

Open **Data → Get Data → From Other Sources → Blank Query → Advanced Editor** and paste this M script for your `Income_5Y` table:

```powerquery
let
    ApiKey = "mw_demo",
    Ticker = "us:NVDA",
    Source = Csv.Document(
        Web.Contents("{{public_base}}", [
            RelativePath = "api/v1/financial-statements/income",
            Query = [
                tickers = Ticker,
                period = "annual",
                limit_per_instrument = "5",
                format = "csv"
            ],
            Headers = [#"X-API-Key" = ApiKey]
        ]),
        [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]
    ),
    PromotedHeaders = Table.PromoteHeaders(Source, [PromoteAllScalars = true])
in
    PromotedHeaders
```

Duplicate that query twice in the Power Query sidebar—changing `RelativePath` to `"api/v1/financial-statements/cash_flow"` (`period = "quarterly"`) and `"api/v1/financial-statements/balance_sheet"`—and click **Close & Load**.

---

## Step 6: Wiring the `DCF_Model` Tab Formulas (WACC, Terminal Value & 5x5 Sensitivity Matrix)

With your four raw tabs (`Income_5Y`, `CashFlow_8Q`, `Balance_Latest`, and `Rates_Consensus`) populated dynamically, you can wire a clean `DCF_Model` summary tab that recalculates intrinsic value per share the instant you type a new ticker into `Config!B2`.

### 1. Computing Live WACC From Treasury Yields & Market Cap Weights

Instead of guessing a flat `10.0%` discount rate for every company, compute Weighted Average Cost of Capital (`WACC`) from live balance sheet and Treasury inputs:

- **Risk-Free Rate ($R_f$):** Link directly to `Rates_Consensus` `y10` (the live 10-Year U.S. Treasury par yield, e.g., `4.25%`).
- **Cost of Equity ($K_e$):** Use CAPM ($R_f + \beta \times \text{ERP}$), where Equity Risk Premium ($\text{ERP}$) is `4.50%–5.00%` and $\beta$ comes from `/api/v1/snapshots?ticker=us:NVDA` (or sector beta benchmarks).
- **After-Tax Cost of Debt ($K_d \times (1 - T)$):** Divide trailing `interest_expense` (`Income_5Y`) by `total_debt` (`Balance_Latest`), bounded at a floor of $R_f + 0.75\%$, and multiply by $(1 - \text{Effective Tax Rate})$, clamping the effective tax rate between `15%` and `25%` so one-off tax credits don't distort WACC.
- **Capital Structure Weights:** Weight $K_e$ by **Market Cap** (`/api/v1/quotes`) and after-tax $K_d$ by **Total Book Debt** (`Balance_Latest`).

### 2. Projecting Years 1–5 Unlevered Free Cash Flow With Growth Fade

To avoid projecting hyper-growth into perpetuity, fade Year 1–2 consensus revenue growth (`Rates_Consensus`) linearly toward a sustainable Year 5 growth rate:

```excel
# Example Google Sheets / Excel cell formulas on DCF_Model:
# Row 10: Projected Revenue (Year 1 to Year 5)
C10 = B10 * (1 + C$8)

# Row 12: Projected Owner FCF = Projected Revenue * Target Owner FCF Margin
C12 = C10 * C$11

# Row 14: Mid-Year Convention Discount Factor = 1 / (1 + WACC)^(t - 0.5)
C14 = 1 / POWER(1 + $B$5, C$9 - 0.5)

# Row 15: Present Value of Year t FCF
C15 = C12 * C14
```

Why use the `t - 0.5` **mid-year discounting convention**? Operating cash flows arrive throughout the four quarters of a fiscal year, not in a single lump sum on December 31. Discounting at `0.5, 1.5, 2.5, 3.5, 4.5` periods prevents artificial `~4%` undervaluation compared to year-end discounting.

### 3. Gordon Growth Terminal Value & Mandatory Valuation Sanity Checks

In cell `G16`, calculate **Terminal Value** at Year 5 using the Gordon Growth formula, capped strictly so terminal growth ($g$) never exceeds the 10-Year Treasury risk-free rate ($R_f$):

```excel
# Terminal Value at end of Year 5 (G12 = Year 5 FCF, $B$5 = WACC, $B$6 = Terminal Growth g)
G16 = IF($B$6 >= $B$5, "ERR: g >= WACC", (G12 * (1 + $B$6)) / ($B$5 - $B$6))

# Present Value of Terminal Value (discounted 5 full years from Year 5 end)
G17 = G16 / POWER(1 + $B$5, 5)
```

Before trusting any DCF output, add three automated **Sanity Check Flags** at the bottom of your `DCF_Model` sheet:

| Sanity Check | Formula / Rule | Why Analysts Require It |
| --- | --- | --- |
| **1. Terminal Value % of EV** | `PV_Terminal_Value / Implied_EV` | If $> 80\%$ of Enterprise Value comes from beyond Year 5, your valuation is a terminal-assumption bet—widen your margin of safety |
| **2. Implied Exit EV / FCF Multiple** | `Terminal_Value / Year_5_FCF` | Shows the exact Year 5 exit multiple implied by $(1+g)/(\text{WACC}-g)$ so you can compare it against historical trading comps (`/api/v1/peers`) |
| **3. Reverse-DCF Implied 5Y FCF CAGR** | Solve for 5Y FCF growth where `Intrinsic_Price == Current_Price` | Framing valuation as *"At $138/share, the market is pricing in 24% annual Owner FCF growth for 5 years"* is far more actionable than a single point target |

### 4.When NOT to Use an Unlevered FCF DCF (Sector Guardrails)

Not every stock in the 90,000+ symbol warehouse should be valued on `Operating Cash Flow - CapEx`:
- **Banks, Insurers & Brokerages (`Financials`):** Deposits, loan originations, and policyholder reserves swing operating cash flow wildly and debt is raw operating inventory, not financing capital. Value financials using a **Residual Income / Dividend Discount (`ROE` vs. Cost of Equity → Justified `P/B`)** model fed by `Balance_Latest` (`total_equity`, `book_value_per_share`) and `Income_5Y` (`net_income`).
- **REITs (`Real Estate`):** GAAP depreciation understates cash earnings while maintenance capex differs from acquisition capex. Value REITs on **Funds From Operations (`FFO` / `AFFO`)** and net debt to EBITDA (`/api/v1/screener` exposes `ffo` and `ev_to_ebitda` directly).
- **International Issuers (`global:SHEL.L`, `global:7203.T`, `global:RELIANCE.NS`):** Always verify `currency` on the financial statement vs. `quote_currency` on `/api/v1/quotes`. For example, Shell plc (`global:SHEL.L`) reports IFRS financial statements in **US Dollars (`USD`)** while its London shares trade in **British pence (`GBp`)**! Convert Implied Equity Value into the listing's native currency (using `/api/v1/fx/rates`) before dividing by diluted shares.

---

## Frequently Asked Questions

### How do I avoid lookahead bias if I backtest this DCF model on historical dates?
Every QuantSet financial statement and screener endpoint supports an `as_of=YYYY-MM-DD` parameter (see [Point-in-Time Dates](/docs/guides/point-in-time)). When you append `&as_of=2023-06-30` to your statement URL, QuantSet filters strictly by the SEC `available_at` public filing timestamp—returning only the 10-K and 10-Q figures that were actually known to the market on June 30, 2023, without leaking later restatements.

### Does this DCF template work for non-US stocks across all 67 countries?
Yes. QuantSet covers **36,000+ companies with standardized financial statements** across 67 countries (`us:NVDA`, `global:SHEL.L`, `global:7203.T`, `global:RELIANCE.NS`, and thousands of European, Asian, Canadian, and Australian issuers) using the exact same `revenue`, `operating_income`, `cash_flow`, and `balance_sheet` column names.

### How many credits does refreshing a 4-tab DCF workbook use?
Testing on the nine flagship sample listings (`us:NVDA`, `us:AAPL`, `us:MSFT`, `us:IVV`, `global:SHEL.L`, `global:1301.T`, `global:RELIANCE.NS`, `crypto:BTCUSDT`, `index:SPX`) with `mw_demo` costs **zero credits and requires no signup**. On a personal key (`250 free credits` at [quantset.dev/signup](/signup), no credit card), a complete single-stock DCF refresh across statements, snapshot, consensus estimates, and Treasury yields uses roughly **23 credits**—meaning you can run **10+ full institutional DCF valuations across any global ticker for $0** before ever needing a `$19` Starter Pack (`2,000` non-expiring credits, or ~85 full DCFs).

---

## Bonus: Run the Same 5-Year DCF + Reverse-DCF in 10 Seconds With Claude or Cursor

Sometimes you want to sanity-check a valuation or run a **Reverse-DCF** (*"What 5-year FCF CAGR is the market currently pricing into `NVDA` or `SHEL.L` at today's share price?"*) before opening a spreadsheet.

Because QuantSet ships an open-source `dcf-valuation` skill (`npx skills add quantset/skills`) wired to the exact same SEC XBRL and Treasury endpoints, you can ask Claude Code, Cursor, or Codex:

> *"Run `/dcf NVDA` (or use the `dcf-valuation` skill) to build a 5-year DCF, SBC-adjusted Owner FCF check, Reverse-DCF implied growth rate, and 3x3 WACC vs. terminal growth sensitivity table."*

Check out the full [SEC EDGAR & XBRL API Playbook](/docs/guides/sec-edgar-xbrl-api) and the [Google Sheets, Excel & Notion Templates guide](/docs/guides/google-sheets-excel-notion-stock-templates) for more copy-paste formulas.
