Finance · 2026
Excel Agent
An Office.js Excel add-in backed by a Python agent that operates on spreadsheet models directly, rather than around them.
all Formulas kept
Finance
2026
Key decisions
- The workbook is read as a dependency graph of formulas rather than a grid of values, because the values are just the graph's most recent evaluation.
- Auditing comes before authoring, because the defects a model review looks for by hand are mechanical to detect on a graph and tedious to find by eye.
- Writes produce formulas that stay formulas, because replacing a model's logic with the numbers that logic produced destroys the model while appearing to update it.
- Writes are blocked unless a simulation artifact has passed, and every mutation captures a rollback snapshot before it is applied, because an agent editing a live model must be able to undo itself cleanly.
Why most spreadsheet tooling is useless on real models
Libraries that read spreadsheets read values. A financial model is not values — it is a dependency graph of formulas, and the values are just its most recent evaluation. Read the values and you have a photograph of a machine.
Excel Agent works on the graph, and it does so from inside Excel: an Office.js
taskpane add-in (plugin/manifest.xml, ReadWriteDocument permission) whose
React workspace reads workbook context — cell snapshots, named ranges, sheet
protection, charts and tables — through the Excel JavaScript API, and talks to a
FastAPI backend over a typed API generated from the backend’s OpenAPI schema.
On the backend, formula_parser.py tokenizes formulas into an AST, builds the
dependency graph, finds circular references by DFS cycle detection, and checks
function arity against a table of Excel function specs. formula_graph.py
turns that into a durable graph artifact — precedents, dependents, volatile
functions, external links, broken refs — over analysis from a Node
workbook-worker running SheetJS, ExcelJS and HyperFormula, so the graph can be
recalculated, not just read. That is what answers the questions that actually
come up in a model review: what feeds this cell, what breaks if this assumption
moves, where is the hardcode buried in the middle of a formula column that
should be uniform.
Auditing before authoring
The first useful behaviour is not writing formulas but finding the defects that model reviews look for by hand — inconsistent formulas across a row that should be uniform, constants embedded where a reference belongs, circularity, ranges that stop one row short of the data, sign convention breaks between sections.
Those are mechanical to detect on a graph and tedious to find by eye, which is exactly the right split of labour. Four verifier agents — syntax, logic, performance and QA — review every plan, and the parser runs financial sanity checks alongside the structural ones (WACC outside 5–15%, tax rate outside 0–50%, magnitude errors with auto-fix suggestions). The audit surface is held honest by a benchmark suite of thirty fixture workbooks — DCF terminal-value chains, LBO cash sweeps, merger accretion/dilution, three-statement models, broken-ref and spill-edge cases — run as a deterministic quality gate, with 232 tests across the backend, the add-in and the worker.
Editing without collapsing
When it does write, it writes formulas that stay formulas. An agent that helpfully replaces a model’s logic with the numbers that logic produced has destroyed the model while appearing to have updated it — and it looks correct until the first time someone changes an input.
The finance templates — DCF, LBO, three-statement, comps, merger, sensitivity,
amortization — generate cell operations whose payloads are formula strings, not
values: a projection row is emitted as =B19*(1+$B$5), so the model the agent
builds recalculates like one a human built. The write path is just as
conservative: the add-in applies operations atomically through the Excel
JavaScript API, the apply gate blocks any write whose simulation artifact has
not passed, and each mutation first captures a rollback snapshot of the range’s
values, formulas and number formats. LLM routing is local-first by task
complexity — LM Studio, then Ollama, escalating to Anthropic or OpenAI only
when the task earns it — so routine edits never leave the machine.