Query Excel Before You Send It to the LLM
How OfficeMaker excelSearch filters a large workbook before a language model sees the rows, so generation uses a reduced extract instead of every spreadsheet cell.
Filter the spreadsheet before the model sees it
An automated process that reads a 500,000-row spreadsheet every working day does not need a frontier model on every row. OfficeMaker can interrogate the workbook deterministically and pass only the relevant records to a cheaper model. On simplified input-token assumptions, that redesign cuts routine LLM input cost from about £4,060 a month to about £0.41, with GPT-6 Astra reserved for genuine exceptions.
This is the same pattern as not dumping an entire Excel file into chat: query first, reason second, escalate only what is hard.
Why the naïve path costs thousands a month
Suppose the job must analyse a 500,000-row spreadsheet each working day.
Assuming approximately 50 tokens per row, processing the whole dataset is about:
500,000 × 50 = 25 million input tokens
If the whole dataset were processed using GPT-6 Astra, currently priced at 0 per million input tokens, the theoretical fresh-input cost would be:
25M × 0 = $250 ≈ £185 per run
Run every working day:
£185 × 22 days ≈ £4,060 per month
That is input processing alone, before output tokens, additional agent reasoning, tool calls or retries. Astra output tokens currently cost $50 per million. A 25 million token prompt would also cross Astra’s long-context pricing band, so this naïve figure is a lower bound.
Redesign the same process properly
OfficeMaker first interrogates the spreadsheet deterministically — convert the file, then `excelSearch` operations such as `getWorkbookInfo`, `queryRows`, `aggregateRows` and `matchSheets`. No language model sits inside that filter. The 500,000 rows reduce to the 2,500 records actually relevant to the task.
That represents:
2,500 × 50 = 125,000 input tokens
If those records are then processed using GPT-5.6 Luna, currently priced at $0.20 per million input tokens:
0.125M × $0.20 = $0.025 ≈ £0.018 per run
In other words, less than 2 pence of Luna input tokens.
Across 22 working days:
≈ £0.41 per month
The workflow can then escalate only genuinely difficult cases — perhaps 100–200 exceptions — to Astra for higher-quality reasoning. Writes still go through keyed edits with approval (`updateRowsByKey` → `approveWrite` → `commitWrite`), not a free-form rewrite of the whole book.
Naïve versus engineered
On the deliberately simplified input-token assumptions above:
That is roughly a 10,000-fold reduction in the routine LLM input cost in this illustrative example.
The same cost discipline shows up when you generate Office files with a schema instead of a script-and-screenshot loop — see Officemaker vs Python/PptxGenJS: Which Is More Token-Efficient?.
How to run this in OfficeMaker
Agents connected through MCP or Domino use the same contract (`excel_search` / `excelSearchOfficeMaker`). Policy, row limits and write approvals stay on the server.
For the consulting framing — which model for which slice of work — see AI Build’s companion note Intelligent Data and Model Selection.
Frequently asked questions
Why is sending a whole spreadsheet to GPT-6 Astra so expensive? At about 50 tokens per row, 500,000 rows is about 25 million input tokens. At Astra’s current 0 per million input tokens that is about $250 (£185) per run, or about £4,060 across 22 working days — before output tokens, tool calls or retries.
What does OfficeMaker do instead of loading the workbook into the model? OfficeMaker converts the spreadsheet once, then interrogates it deterministically with excelSearch. Only the matching records — in this example 2,500 rows — are passed to the language model.
Which model should process the filtered rows? Routine reasoning on the reduced set can run on GPT-5.6 Luna. Escalate only genuine exceptions — perhaps 100–200 cases — to GPT-6 Astra.
Are these figures a quote or an illustration? They are a deliberately simplified input-token illustration using published Astra and Luna rates. They exclude output tokens, agent reasoning, tool calls and retries.
Explore the Excel Best Practices guide for how to keep source workbooks queryable in the first place.