In brief
- Reliable extraction means correct values, each traceable to its page or cell, checked by rules, with exceptions sent to a person.
- Define the fields and the "not found" behavior first. Let the model read and let formulas or code do the arithmetic and the checks.
- Test on a gold set of real documents with human-verified values, and measure accuracy field by field.
Pulling data out of PDFs and spreadsheets is the kind of task that looks effortless in a demo and causes quiet damage in production. A model reads an invoice and returns a clean table, and nobody notices that the total is wrong in one document out of fifty. Reliable extraction is not a better prompt. It is a small system: a definition of what you want, a way to trace every value, rules that check the results, and a path for the cases that fail.
Know what you are feeding it
| Input | Typical problem | What helps |
|---|---|---|
| Text-based PDF | Tables that break across pages, multi-column layouts | Ask for page references, check table continuity |
| Scanned PDF or photo | Misread digits, skewed pages, stamps over text | Verify key figures against the image, flag low-quality scans |
| Excel with data tables | Merged cells, hidden rows or sheets, several tables per sheet | Have the tool list sheets and structure before extracting |
| Excel with formulas | Formula and displayed value differ, external links | Read both value and formula, note any links |
| Mixed packet | Several document types in one file | Classify each page first, then extract by type |
Define the schema first
Write down the fields you need before anyone runs a document through. For an invoice: vendor name, invoice number, invoice date, due date, currency, line items (description, quantity, unit price, amount), subtotal, tax and total. For each field, state its type, its format, whether it is required, and any allowed values. Then state what to do when a field is absent. The instruction should be "return nothing for this field and say it was not found," because a model left to its own devices will often fill gaps with something plausible.
Make every value traceable
Each extracted value should carry its source: the page number and the text it came from, or the sheet and cell. This is what makes review fast. A reviewer should be able to see a value, click or look straight to where it came from, and confirm it in seconds. A table of numbers with no location data is a table you have to take on faith.
Validate with rules, not hope
Do not ask the model to be careful. Check the results with rules that do not depend on it. A short list covers most documents.
- The line amounts add up to the subtotal, and the subtotal plus tax equals the total.
- Quantity times unit price equals the line amount.
- Dates are plausible and in sensible order, with the due date after the invoice date.
- The invoice number is not a duplicate of one already processed.
- The currency is recognized and the vendor exists in your vendor list.
- For spreadsheets, row counts and column totals match the source, and key columns pass a cross-foot.
Let the model read, and let a formula or a script do the arithmetic. A language model is a poor calculator and an excellent reader. Putting each in its own role makes the whole system more reliable.
Send exceptions to a person
Documents that fail a check, or where the model reports low confidence, go to a human queue. Documents that pass go through. Show reviewers the failing check and the source location so a decision takes seconds. Track the exception rate by document type and by vendor. A vendor whose invoices fail constantly is telling you something about their format, and so is a rising rate after a change you made.
Test on a gold set
Before anyone relies on the system, assemble thirty or so real documents of the kinds you will process, and have a person record the correct values for each field. Run the extraction and score it field by field, not document by document, because an overall accuracy figure hides the fact that a few fields, usually amounts and dates, are the ones that matter. Look at the failures and fix the schema or the instructions. Re-run the set after every change, and add new problem documents to it as they appear.
Spreadsheet specifics
Spreadsheets deserve their own checks. Ask the tool to describe the structure first: sheets, hidden rows and columns, merged cells and where each table begins. Watch for units and signs in the header ("in thousands," "credits shown as negatives"). Dates stored as text, numbers stored as text and percentages stored as fractions all produce errors that look like valid data.
Where the results go
Do not send extracted data straight into your accounting or operations system. Land it in a staging area, let the checks and the reviewer clear it, and then import it with a record of who approved what. Davy's chat and documents page shows documents being uploaded and analyzed with answers that point back to their sources, and the integrations page explains how Davy approaches connections to the systems where the data finally lives.






