Extract invoice data and flag uncertain records
PDF invoices become spreadsheet rows, while incomplete results enter a separate review queue. This can be adapted for an accounting firm or finance team.
How this works
PDF invoices become spreadsheet rows, while incomplete results enter a separate review queue. This can be adapted for an accounting firm or finance team. Use an explicit field schema so extraction errors become visible before financial records are used. The review queue should contain specific failed checks, not an opaque confidence score.
Keep the original invoice beside an extracted row and its page evidence. Use AI or OCR for reading and deterministic code or spreadsheet formulas for types, dates, arithmetic and duplication checks. Valid extraction is not permission to pay or post an expense.
Before you start
Extraction schema
Define supplier, invoice number, issue date, currency, net, tax and gross fields with required versus optional status.
Original storage
Choose a restricted document folder and stable document IDs before importing PDFs.
Review ownership
Name the finance reviewer and define accepted, needs-review and rejected states.
Prepare the inputs
- document_id
- Required
string and original PDF reference
Retain the complete PDF and a file fingerprint.
- invoice_text
- Required
page-indexed OCR or extracted text
Record unreadable pages and extraction method.
- field_schema
- Required
field names, types and required flags
Reject unrecognized schemas rather than silently dropping fields.
- prior_invoice_keys
- Required
supplier and invoice number pairs
Include prior accepted and pending records when checking duplicates.
Implementation, step by step
Register the document
- Assign an immutable document identifier and record its page count.
- Extract text using an available reader; save OCR output separately rather than altering the original.
Checkpoint: Original and text can be compared page by page.
Extract a structured row
- Ask the assistant to fill only the approved fields and include page references for amounts and identifiers.
- Represent unreadable values as null with a reason; separate printed values from calculated values.
Checkpoint: A typed draft row includes evidence references.
Validate mechanically
- Parse dates and decimal amounts using the document's locale; verify currency and required fields.
- Recompute net plus tax minus discounts against gross using documented rounding rules.
Checkpoint: Each failed check has a specific reason code.
Route for review
- Send incomplete, duplicate or inconsistent rows to the review tab with the source link.
- Place structurally valid rows in the extracted register without labeling them approved for accounting.
Checkpoint: Both queues reconcile to the number of input documents.
Resolve and retain corrections
- Let finance correct fields while preserving the initial extraction and reviewer identity.
- Re-run affected checks after corrections; export CSV if the spreadsheet connector is unavailable.
Checkpoint: The row has a review status and correction history.
Decisions along the way
Multiple invoices in one PDF
Split records by invoice boundaries while retaining the parent document identifier.
Tax field is absent
Use unknown unless an explicit zero or applicable approved rule supports zero.
Duplicate key found
Hold both records for comparison; a repeated invoice number alone may span different suppliers.
What you will produce
invoice-register.csv
CSVStructured extracted records retaining a finance review state.
Include: document_id · supplier · invoice_number · date · currency · net · tax · gross · status
invoice-exceptions.csv
CSVA queue with actionable corrections and original page references.
Include: document_id · field · reason · evidence · reviewer · resolution
Check the result
- Reconcile input document count with accepted, held and failed records.
- Recalculate every amount relation without relying on generated arithmetic.
- Spot-check clear rows as well as low-quality scans against originals.
- Confirm that model confidence never overrides missing required evidence.
When something goes wrong
Rotated or faint scan
Retry extraction on the affected page; retain unreadable status if evidence stays unclear.
Unexpected credit note
Route to the correct document type and retain negative signs.
Spreadsheet write fails
Keep a local export with stable row IDs and reconcile before another import.
A worked example
SYNTHETIC EXAMPLE · NOT A REPORTED BUSINESS RESULT
Request
Synthetic: extract a two-page invoice.
Inputs
Invoice I17 shows net 800.00, tax 160.00, gross 960.00 EUR; the invoice number is blurred. PDF fingerprint F17 is new.
Expected result
Synthetic result: amounts reconcile to 960.00 EUR, but invoice_number=null and status=needs-review. Do not generate an invoice number or send this row to a payment queue.
Run a small pilot
Start small
Use a mixed sample of clear PDFs, scans, credit notes and duplicates.
Record the baseline
Measure field correction rates and manual minutes per document.
Agree success criteria
Agree field-level accuracy and exception-recall requirements with finance before scaling.
Stop or revise
Stop automatic routing if missing fields appear as zero or originals cannot be traced.
Keep the scope clear
- Document extraction does not approve supplier identity, tax treatment or payment.
- Store financial documents only in the workspace authorized for this workflow.
Check before using
Compare invoice details and amounts with the original. A model’s confidence score does not establish accuracy.
Business activities
- Manage finances and accounting
FROM A RECIPE TO YOUR WORKFLOW
Bring the company context together.
This workflow needs reliable inputs before it needs a better prompt. Moat8 Vault brings working information into a readable archive for the AI tools you use.
For this recipe: An invoice PDF · Fields to extract · Two spreadsheet tabs
Start with one recurring task, agree which sources to use, and review the first result with your team.
Discuss this workflow