Use caseDocument AIWorkflow automation
PDFs into rows: document data entry that sends only the doubtful fields to a person
Automate data entry from PDFs, scans and photos: each field extracted with its place on the page, checked in code, and only doubtful values sent to a person.
A blueprint, not a client story. The business described is illustrative; the architecture, integrations and trade-offs are real, and this is how I would build it. By Ergini, .
The short version
A document pipeline for operations and finance teams that turns PDFs, scans and phone photos into checked rows in a spreadsheet, TMS or ERP. It watches an inbox or folder, classifies what arrives and extracts each field with its position on the page. Code checks every value against formats, totals and the record it refers to. Doubtful fields go to a review screen that shows the page beside the value; the rest are written automatically, and each correction becomes a test case.
- Best for
- Teams keying the same fields from delivery notes, proofs of delivery, certificates or statements into a system every day, from senders whose layouts all differ.
- Connects to
- Gmail and Google Drive, Excel and Google Sheets, TMS or ERP, OCR or vision model, Review screen
- The AI does
- Reads each page, including rotated scans and handwriting, and fills a fixed schema with the value, the position on the page and a confidence for every field.
- People do
- Check the fields the system flags, handle documents it cannot match to a record, and decide anything involving a damage remark or a disputed quantity.
- Built as
- AI Workflow Automation, usually $3.5K - $12K
The paperwork behind every delivery
Take a regional haulier with its own warehouse, running a few hundred deliveries a day. Every delivery ends in paper: a delivery note or a CMR consignment note, signed by the receiver, often stamped, sometimes annotated in pen. About 3,000 proofs of delivery come back each month. Drivers photograph them on the dashboard, subcontracted carriers email scans, and the depot office feeds the rest through a scanner that saves one long PDF per batch into a shared Drive folder.
Two people in the office open each file, find the shipment in the TMS and type in what the paper says: delivery date, pallets received, the receiver's name, and any remark such as 'unter Vorbehalt' or '1 pallet damaged'. Then they attach the PDF so billing can invoice. A proof of delivery nobody has opened holds up an invoice. A remark nobody typed in comes back weeks later as a damage claim the team cannot answer from its own records.
Most of these pages are perfectly legible, and every carrier sends a different format. The TMS cannot read paper, a template-based parser needs a new template for each subcontractor, and a PDF-to-Excel converter cannot tell a delivered quantity from a planned one. What the office needs is a pipeline that reads the page, checks what it read against the shipment it belongs to, and interrupts a person only when something does not add up.
One batch scan, field by field
A three-page PDF from the depot scanner, as the pipeline handles it. Each result is all the next step is allowed to use.
Depot scanner to Google Drive, Tuesday 06:42
- split_and_orient(file: "depot_batch_0642.pdf")3 pages, 2 documents: CMR note (pages 1-2), delivery note (page 3) / page 2 upside down, rotated on a working copy / original file untouched
- extract(document: 1, schema: "pod_cmr_v4")12 of 14 fields clear / pallets_received: '11', handwritten, box 24, 0.71 / remark: 'unter Vorbehalt, 1 Pal. beschädigt', handwritten, box 24, 0.58
- validate(document: 1)shipment HB-448120 found in TMS / consignee matches order / delivered after pickup / 11 pallets received against 12 loaded: shortage / remark present
- route(document: 1)review: pallets_received, remark / automatic: 12 fields / customer service task: shortage and damage remark
Office clerk · Review screen
Crop checked: 11 pallets, remark reads 'accepted with reservation, 1 pallet damaged'. Both confirmed.
- write_tms(shipment: "HB-448120", key: "sha256:9f2c...e1:doc1")POD attached / status: delivered with exception / damage task opened for customer service / a repeat call with the same key changes nothing
- Document 2, the delivery note on page 3, passed every check and was written without anyone looking at it. Both corrections from document 1 joined the handwriting test set.
What happens between the scanner and the TMS
The model is used twice: to find the documents in a file and to read them. Everything that decides whether a value is trusted, and everything that writes to your systems, is ordinary code.
01 Trigger · Gmail API push, Drive changes feed
A file arrives
An email lands in a watched Gmail label, or the depot scanner saves a PDF to a Drive folder. Each file is hashed on arrival, so a scan forwarded twice is processed once.
02 Plain code · PDF toolkit
Split, rotate and render
Pages are rendered to images, and orientation and skew are corrected on a working copy. The original file is never modified, because it is the record.
03 AI model · Vision model
Find the documents in the file
A model labels each page (first page of a CMR note, continuation, cover sheet, blank), so a 40-page batch becomes 17 documents. A page that fits nothing is flagged, never dropped.
04 AI model · OCR or vision model
Read the fields into a schema
Each document type has its own schema, enforced with structured outputs. Every value comes back with its page, its box on the form and whether it was printed or handwritten. Barcodes are decoded by a barcode library, not read by the model.
05 Plain code · TMS or ERP API
Check every value
Formats, lookups against the TMS, cross-field rules (received against loaded, delivery after pickup) and totals across pages. Confidence is computed from these checks and from agreement between two independent reads, not from the model's opinion of itself.
06 Decision
Trust it, check it, or stop
Thresholds are set per field and per document type, in configuration the operations lead can read.
- Every field passes its checks and clears its threshold then written straight to the TMS or the sheet
- Some fields are doubtful, or there is a handwritten remark then only those fields go to the review screen
- No matching shipment, an unknown document type, or pages that do not add up then the whole document goes to an exception queue
07 Person · Review web app
A clerk checks the doubtful fields
The review screen shows the crop of the page beside each flagged value. Enter accepts, typing corrects, and clear fields are visible but not asked about.
08 System · TMS API, Drive API
Write once, attach, file
The shipment is updated and the PDF attached through the TMS API, keyed on the file hash so a retry cannot create a second record. The file is then filed in Drive by customer and month.
09 Result
Corrections become tests
Each correction is stored with its page crop and the right answer. Any change to prompts, models or thresholds is scored against that set before it goes live.
The proof-of-delivery schema, and the rule behind each field
Every document type gets a schema like this one. The last column matters most: it says what happens when a check fails, and no row says guess.
| Field | Where it usually is | Checked in code by | When the check fails |
|---|---|---|---|
| Shipment reference | Printed near the top, often also as a barcode | Barcode first, then the reference pattern, then a TMS lookup | Exception queue: a document that matches no shipment is never filed on a guess |
| Delivery date | Stamp or handwriting beside the signature (box 24 on a CMR note) | Not before pickup, not in the future, within a set window of the planned date | The field goes to review |
| Receiver name and signature | Signature block and company stamp | Signature box not empty, printed name present | No signature, no valid POD: the carrier is asked for a proper one |
| Consignee and address | Printed | Fuzzy match against the order after normalizing legal forms and street abbreviations | The field goes to review below the match threshold |
| Pallets or packages received | Handwritten over or beside the planned figure | Whole number, compared with the quantity loaded | A difference is reported to customer service, never corrected silently |
| Remarks and reservations | Handwritten, in the receiver's language | Classified as none, damage, shortage, refused or other | Anything other than none goes to a person, every time |
| Line items | A table that may run over several pages | Rows stitched across pages, repeated headers dropped, lines summed against the printed total | The document goes to review with its pages side by side |
The pages that break a simple parser
Clean, typed PDFs are the easy part. These are the documents that decide whether the office still trusts the output after the first week.
Phone photos taken at an angle
Drivers photograph paper on a steering wheel, in bad light, with a thumb in the frame. The pipeline corrects perspective and rotation on a working copy, and rejects images below a resolution floor with an automatic request to send another, because a guessed pallet count costs more than a second photo.
Handwriting exactly where it matters
The printed parts of a delivery note are the parts nobody needs. Quantities received and remarks are handwritten, and they carry the money. A handwritten number needs two independent reads that agree before it is trusted, and a handwritten remark always reaches a person.
Seventeen documents in one PDF
A batch scan mixes CMR notes, delivery notes, cover sheets and the odd blank page. Page labels split the batch, and a reconciliation step checks that every page was assigned to exactly one document before anything is written.
Tables that continue on the next page
Multi-page delivery notes repeat their column headers and sometimes their subtotals. Code refuses the extraction unless the stitched lines, repeated headers removed, add up to the printed total.
Confident and wrong
The dangerous error is not a blank field but a clean, plausible wrong value, such as a 1 read as a 7. Cross-field rules catch most of these, and a weekly hand check of a sample of straight-through documents measures what the rules miss.
How a document type earns straight-through processing
Nothing is written unreviewed on day one. Each document type moves up on evidence from your own paper, not from a demo.
- Collect a few hundred real documents per type, including the bad photos and the batch scans, and record the correct values. That is the first test set.
- Run the pipeline in parallel with the office for two weeks. The clerks key documents as usual, and the pipeline's output is compared with theirs field by field, with disagreements settled by looking at the paper.
- Switch on the review screen for every document. The clerks confirm instead of typing, and each correction is logged with its field and its reason.
- Set thresholds per field from those corrections. A field goes automatic only when its error rate is below the office's own keying error rate, which the parallel run measured.
- Go straight-through one document type at a time, and keep the weekly sample check running after launch. The post on evaluation frameworks covers how that scoring is set up.
Handwritten remarks never go automatic. That is a design decision, not a threshold.
When the documents may not leave your servers
Proofs of delivery carry names, signatures and sometimes private addresses, so this is personal data under GDPR. For most companies an EU-region model endpoint under a data processing agreement, with no retention of inputs, is enough. Some cannot send documents to any outside provider, because a customer contract forbids it or the goods belong to a public-sector customer.
For them, reading documents on their own hardware is now practical. Mistral OCR 4, released in June 2026, reads 170 languages, returns bounding boxes and confidence scores, and is offered to enterprise customers for self-managed deployment in a single container. Paired with an open-weight model for the schema step, on an EU server or on premises, no page leaves your infrastructure. The trade is a fixed server cost in place of per-page fees, and more of the operations become yours; the self-hosted LLM page covers that side.
In Germany, records kept under GoBD must stay unaltered, so the pipeline stores every received file exactly as it arrived and does all rotation and cleanup on copies. The extracted data links back to that original, which is what an auditor will ask to see.
Would an off-the-shelf parser do the job?
Often, yes. If your documents come from a handful of senders with fixed layouts and the goal is rows in a spreadsheet, Docparser's template rules or Nanonets will get you there in days. For invoices, Rossum and the prebuilt invoice models in Azure Document Intelligence and Google Document AI are mature, and ABBYY serves large, high-volume operations. Try one on fifty of your real documents before paying anyone to build; if that is where you should stop, I will say so.
A custom pipeline earns its cost when the output has to be checked against your own records and written into them: a shipment that must exist in the TMS, a quantity compared with what was loaded, a remark that opens a task for customer service. It also wins when layouts vary across hundreds of subcontractors, when handwriting carries the values that matter, or when documents must be processed on your own servers. Exporting a CSV is the easy part; the checks, the review screen and the write-back are what remove the typing.
The two combine well. A reading layer from Azure Document Intelligence or Google Document AI can sit inside a custom pipeline that owns the schema, the checks, the review queue and the connection to your systems, and swapping the reading layer later leaves the rest untouched. The document extraction deep dive compares the reading options.
How you would know it is working
A blueprint has no results to report, so here is what I would measure from the first week instead, on your own data.
- Straight-through rate per document type
- Share of documents written with no field reviewed, tracked per type and per sender, because one awkward carrier template can hide inside an average.
- Field accuracy on the test set
- Scored on every release against corrections from real reviews, field by field. A drop blocks the release.
- Silent error rate
- The weekly hand check of straight-through documents. It is the number that catches confident wrong values the rules missed.
- Review time per document
- Seconds from opening a review item to confirming it. If it rises, the crops or the thresholds need work.
- Days from delivery to POD in the TMS
- The business number: how long an invoice waits for its proof of delivery.
What a build like this costs
This is built as AI Workflow Automation, which runs $3.5K - $60K overall. A build like this one usually lands in the single-step flow tier: $3.5K - $12K, 1-2 weeks. The first working version runs on your real data well before the end of that window.
What it costs to run
Model and OCR costs are usually cents per document rather than dollars, with a little more where handwriting gets a second read. At a few thousand documents a month the model bill stays small, which is why self-hosting is usually a data residency decision rather than a cost one.
What moves the price
- How many document types there are, since each needs its own schema, rules and test set
- Where results go: a Google Sheet is quick, while writing into a TMS or ERP with lookups and idempotent updates takes longer
- The share of phone photos and handwriting, which decides how much second-read and review logic is needed
- Whether processing must be self-hosted rather than run on an EU-region API
- Turnaround: documents processed minutes after they arrive, or in a nightly batch
Who this is for
- Hauliers, 3PLs and forwarders whose proofs of delivery arrive as phone photos, email scans and batch scans from many subcontractors
- Accounting and bookkeeping firms keying supplier statements, bank statements and forms from a weekly pile of client paperwork
- Operations teams that tried a template-based PDF parser and gave up when every sender's layout turned out different
- Companies whose documents contain personal or confidential data and must be processed in the EU or on their own servers
Questions people ask about this
Can AI extract data from a PDF into Excel?
Yes, and the reading part is now reliable on clean documents. The work is in what surrounds it: a schema per document type, checks on every value, and a review step for the fields the system is unsure of. The output can be one row per document in Excel or Google Sheets, with a link back to the source PDF and the page each value came from.
How do I automate data entry from PDFs?
Start with one document type and a few hundred real examples with known correct values. Collect files in one inbox or folder, classify them, extract fields into a fixed schema, validate each value in code, send only doubtful fields to a person and write the rest to your system. Run it in parallel with manual keying first, and let it write on its own only where the numbers show it matches the office.
How do I handle documents when every sender uses a different format?
Use a model that reads by meaning instead of a template per sender. The same schema applies whatever the layout, and a new format has to pass the same checks as every other document. If it fails them it goes to an exception queue, and its corrected examples join the test set, so the next document from that sender goes through without anyone drawing a template.
How accurate is AI extraction on scanned and handwritten documents?
Printed fields on reasonable scans are read reliably; handwriting and poor phone photos are where errors cluster. That is why this design measures accuracy per field on your own documents, needs two agreeing reads before it trusts a handwritten number, and always shows handwritten remarks to a person. I would test on a sample of your real paper, the ugly pages included, before promising anything.
What does automated PDF data extraction cost to run?
Usually cents per document in model and OCR fees. The build is the larger cost, and it depends on the number of document types and on whether results are written into a TMS or ERP rather than a spreadsheet. Self-hosting replaces per-page fees with a fixed monthly server cost, which pays off at higher volumes or when data residency requires it.
Sources