Extracting data from PDFs with AI and the GRID API
Extract data from PDFs with LLMs and feed it into the GRID spreadsheet engine for accurate, API-ready results—perfect for quotes, reports, and AI assistants.
Alexandra Dilja Bjargardottir8 April 2025 · 4 min read
PDFs are everywhere — invoices, reports, product catalogs, policy documents. While they’re great for sharing information, they’re not exactly easy to work with when you want to do something useful with the data inside.
This is where the combination of a large language model (LLM) and the GRID API comes in handy. LLMs can be used to extract structured values from a PDF, and the GRID spreadsheet engine can take those values and plug them directly into spreadsheet models that calculate, compare, and return accurate calculations — all via an API.
The spreadsheet engine plays a critical role in this process. While LLMs are impressive, they weren’t built for math. They regularly hallucinate numbers, miscalculate logic and confidently return incorrect results. That’s a deal-breaker when your AI needs to handle real business logic and provide outputs people can trust.
By pairing the language and document parsing capabilities of an LLM with the calculation power of the GRID spreadsheet engine, you get the best of both worlds: smart extraction and reliable math.
Together, this setup unlocks a wide range of use-cases: auto-calculating responses to form submissions, generating quotes or offers, or powering intelligent assistants that reply with real, accurate insights.
A practical example: From PDF to mortgage comparison tool
One use-case we’ve explored with a customer in the mortgage space (Win the House You Love) involves helping homebuyers understand their loan options more easily. Their team was looking to simplify the process of interpreting standard loan estimate PDFs.Imagine turning a static document like that into a live, interactive chat experience where key details are extracted using AI, the calculations are handled behind the scenes by a spreadsheet model, and the results are displayed in clear, interactive charts.Here’s what that flow could look like in practice:
1. Start with a PDF loan estimate
Loan estimates contain important numbers — interest rate, loan amount, loan term, taxes, insurance, fees — all of which shape the monthly payment and total cost of a loan. But the format they come in is static, typically a PDF, and not designed for easy data extraction or automation.
2. Extract the relevant values using an LLM
An LLM reads the PDF and pulls out the necessary values and labels. LLMs are well-suited for this task as they are especially good at understanding semi-structured documents like these, where the data is consistent but the formatting can vary slightly between sources. They’re able to interpret headings, fields, and context — pulling out standard data like loan amount, term length, and escrow payments without needing custom logic.

3. Send the values to a spreadsheet model via the GRID API
The extracted values are passed into a spreadsheet model hosted in GRID which already contains the formulas and logic to calculate monthly payments, compare loan types, and summarize costs.
This is where business logic lives — in a format many teams already know and trust. With the GRID API, there’s no need to recode this logic into a custom backend. The spreadsheet is the backend.

4. Power the chat with calculated spreadsheet outputs
The spreadsheet runs in the background, and the results — monthly payment, total loan cost, comparison metrics or even visualizations like charts — are delivered to users through the interface.
The GRID API acts as the connective layer, ensuring each response is accurate, verifiable, and reflects the latest inputs.
As users interact with the chat, their inputs are sent to the spreadsheet via the API, triggering live calculations. These are done dynamically — the original model remains untouched. Once connected, a spreadsheet is effectively transformed into a scalable web service that can respond to queries in real time, run calculations on demand, and return results, while preserving the original logic and data.
This makes it easy to compare options, test different scenarios, or support multiple users without risking unwanted edits to the source file.

Why it works
This setup has a few major advantages:
Flexible data extraction: The LLM handles variability in formats — pulling out key values like interest rate, down payment, and insurance even when formatting differs between documents.
Accurate, verifiable calculations: All the logic lives in a spreadsheet — where it likely already exists. By running extracted values through a spreadsheet engine, you get accurate, verifiable results. With the GRID API, your spreadsheet becomes a live backend that recalculates on the fly as users interact.
Everything connected by API: The workflow is powered by simple, flexible API calls. That makes it easy to plug into a chat assistant, an internal tool, or even a public-facing application.
It’s a great example of how modern language models and spreadsheet logic can work together — turning static content into actionable insights grounded in accurate calculations.
Want to try it yourself?
You can sign up and start using the GRID API to build workflows like this with your own spreadsheet data and models. If you’re working with LLMs, PDFs, or any kind of data extraction, it’s a fast and reliable way to automate real business logic — without rebuilding what already works.
Leave the language to LLMs and the numbers to us.
👉 Sign up
News
Updates and announcements
27.11.2026
The Python was right. The spreadsheet was wrong.
On 400 spreadsheet tasks, the agent without an engine scored 78% and the agent with GRID scored 90.75%. When we required formulas where the reference workbook had formulas, the same workbooks scored 54.25% without an engine and 87% with GRID.
19.11.2026
How AI builds a spreadsheet: openpyxl, then 430 MB of LibreOffice
In September, Simon Willison went poking around his disk and found 1.7 GB of runtime inside OpenAI's Codex desktop app, since renamed ChatGPT. Next to Python, Node and git sat a complete headless LibreOffice: 430 MB of office suite, shipped so the agent can work with documents. This did not surprise us. We have watched this pipeline since the first AI spreadsheet experiments, and it is still how most of the industry builds spreadsheets with AI. It made sense as a stopgap. It doesn't anymore: next to an engine built for the job, it is less accurate, far slower and more than a hundred times bigger. The recipe Ask an AI agent for an Excel model and it will almost always write the file with openpyxl, the Python library all over its training data. openpyxl writes formulas but cannot calculate them, so the formula cells hold no values. Anything that reads the stored values sees blanks: the Python data library pandas, file previews, and the agent itself, checking its own work. And the model writes formulas the way a person types them, not the way Excel stores them. Leave out the _xlfn. prefix Excel expects on XLOOKUP inside the file and the cell opens in Excel as #NAME?. Write a LET without its _xlpm. prefixes, or a spill reference like A1#, and Excel greets the whole file with "We found a problem with some content". So the pipeline needs something to calculate the file, and the answer is nearly always LibreOffice. Anthropic's public xlsx skill runs LibreOffice to recalculate the workbook. Alibaba's QwenPaw agent ships an adapted copy of the same script. Moonshot's Kimi checks its files against LibreOffice's recalculation, according to an extracted copy of its skills. OpenAI bundles the whole suite into its desktop app. LibreOffice is free, it is already there, and it opens xlsx. None of that means it calculates like Excel. So how close does it get? Missing one case in eight Last week we published the GRID Spreadsheet Benchmark: over 100,000 test cases from eight open source test suites, 13 engines, every case checked against Excel itself. LibreOffice matches Excel on 87.4% of them. That sounds respectable, and LibreOffice Calc is a good spreadsheet app. The test is deliberately hard: it is built from edge cases, not the SUMs that fill most of a real model. But edge cases are where a model goes quietly wrong, matching Excel on them is a high bar, and the last few percent are where the hard work is. 87.4% is 126 misses in every 1,000 cases. The GRID engine gets 1.2 wrong. LibreOffice isn't sloppy. It is a different spreadsheet app with its own opinions. On its own project's test suite it agrees with Excel only about 84% of the time, because many of those tests expect LibreOffice's answer: it converts units Excel has never heard of, and it finds interest rates where Excel gives up with #NUM!. Of the nearly 500 Excel functions in the benchmark, only 16 pass every test in LibreOffice. In GRID, 439 do. Then the tool starts dictating the spreadsheet. Anthropic's skill tells the model to never use XLOOKUP, XMATCH, SORT, FILTER, UNIQUE or SEQUENCE, saying the LibreOffice it runs can't evaluate them. LibreOffice has handled them since 2024, but the rule stands: the agent builds an older, worse spreadsheet to suit its calculator. "We found a problem with some content" In most of these pipelines, when LibreOffice recalculates a file, it also saves it, and it saves it the way LibreOffice understands it. Usually the file still opens in Excel. Sometimes it doesn't. Take the sensitivity table, a fixture of every financial model: a what-if data table showing, say, the implied share price under different WACC and terminal growth assumptions. Put a workbook with one through a pipeline that saves through LibreOffice, like QwenPaw's, open it in Excel, and you get "We found a problem with some content". LibreOffice has written the table back as a formula Excel doesn't have. Click Yes, and Excel repairs the file by turning every cell of the table into a fixed number. The numbers are right for today's inputs. Change the WACC and nothing moves. The model still looks finished. It just stopped being a model. Anthropic's skill was recently changed to recalculate on a copy and write only the values back into the file. That is a sensible patch, and an admission that LibreOffice can't be trusted to save the file. It is still trusted to calculate it, and to tell the agent the file is fine. That trust is misplaced too, because LibreOffice waves through problems it didn't cause. Ask an agent for a table with years as column headings, 2025 and 2026, as in nearly every financial model. openpyxl writes the headings as numbers, and Excel requires table headings to be text. Name a table Q1 and it is the same story, since Excel reads that as a cell address. LibreOffice opens these files, recalculates them without complaint and saves them. The agent's check passes. Excel opens the file with "We found a problem with some content". 430 MB and a second and a half Even when it gets the answer right, LibreOffice is the wrong shape for the job. Every check boots a desktop office suite in headless mode, loads the file, calculates, and writes the file back. On nearly 1,800 benchmark workbooks, run on the same machine, that took a median of 1.6 seconds per workbook. The GRID engine took 18 milliseconds, and it doesn't need to save: it holds the workbook in memory and writes the file once, when the agent is done. These are small workbooks, so most of that time is LibreOffice starting up, and today's agent skills pay it on every check. Anthropic's starts it twice. The obvious fix is to keep it running. In a separate test it still took about 80 milliseconds per workbook, and now the client keeps an office suite running in the background whenever a spreadsheet might come up in any thread. Then there is the weight. ChatGPT's headless LibreOffice is 430 MB. The GRID engine is a 3.5 MB package that runs in process, in Node or in the browser. The embedded LibreOffice may actually be doing other jobs too, like rendering documents and converting them to PDF. But those jobs have lighter tools as well. SuperDoc builds, edits and renders Word documents in the browser: an engine for DOCX, the way GRID's is for XLSX. A couple of small JavaScript libraries turn DOCX into PDF without a desktop suite. However you slice it, 430 MB of LibreOffice in a client is a kludge. Calculate it right AI is about to write more spreadsheets than people ever did. Those files will be opened in Excel, sent to clients and used for decisions, and Excel is where the numbers are checked. If an agent's model shows one figure and the same file shows another in Excel, the user doesn't conclude that LibreOffice and Excel differ on a corner case. They conclude the AI got it wrong. They start rechecking every number, and they stop trusting the next model before they open it. One wrong cell is enough to spend the trust that was supposed to save them the work. The GRID engine calculates the way Excel does, in milliseconds, without an office suite attached. The benchmark and its harness are open, so check the numbers. If you build agents that write spreadsheets, talk to us.