How to Extract Invoice Data From PDFs Into Excel

For anyone retyping invoice figures into rows: the extraction method built around the cross-check that catches bad documents.

A guide from FileCraft Desk Resources. The methods here are the ones the shop runs on paid work; the examples use invented data and say so.

Start with the two kinds of PDF

An invoice PDF is one of two things, and the method differs. A born-digital PDF was produced by software: the text is really in the file, and it can be pulled out exactly. A scanned PDF is a photograph of a page: the text has to be read by OCR, and OCR is a reader that sometimes misreads. Treating a scan as if it were born-digital is how wrong figures get into spreadsheets with total confidence.

Either way, extraction alone is not the job. The job is extraction plus the cross-check that proves each document's figures tie, because a spreadsheet full of unverified figures is just faster typing. This guide covers both, and it is the same method our PDF data extraction service runs.

The method, in order

Step 1: Decide the fields before you extract anything

Write down the columns first: document number, date, and one row per line item with description, quantity, unit price, and amount, plus the document's printed subtotal, tax, and total carried on its rows. Deciding mid-pile produces a spreadsheet whose shape changes halfway down, and every later step, including the cross-check, depends on the printed figures being captured, not just the lines.

Step 2: Extract one row per line item

Born-digital files give up their text directly; most spreadsheet and PDF tools can pull it, and the work is arranging it into the columns from step 1. Scans go through OCR, and each page gets a confidence score from the reader. Keep the score with the page. Low-confidence pages are the ones a human spot-checks later, and a figure the reader could not make out is left blank and flagged, never filled in by feel.

Step 3: Cross-check every document

Two sums, per document, no exceptions:

  1. The line item amounts sum to the printed subtotal.
  2. The printed subtotal plus the printed tax equals the printed total.

A document that passes both is done, and you can say why you trust it. A document that fails either is flagged with both figures and the difference. The flag is not a problem with your extraction; it is usually the supplier's arithmetic, and it is exactly the thing this step exists to catch.

Step 4: Handle exceptions by flagging, never by forcing

When a document does not tie, the wrong move is adjusting a line item so it does. That turns the supplier's error into your falsified record, and the next person to compare spreadsheet against invoice finds a mismatch with no explanation. The right move: deliver the figures exactly as read, attach the flag with the difference, and send the query back to the supplier. Documents with no printed totals cannot be cross-checked at all; list them as unchecked rather than letting them blend in with the passes.

Step 5: Spot-check the weak scans

Sort the scanned pages by their confidence scores and read the lowest ones against the originals. OCR errors cluster where the scan is faint, skewed, or stamped over. Ten minutes on the worst pages catches most of what OCR got wrong, and the cross-check in step 3 catches much of the rest, because a misread figure usually breaks a sum.

A worked example: one pass, one flag

Demonstration data is invented. Both documents below were written for this guide; they are not client documents.

INV-3102 passes. Line items of $42.00 and $118.25 sum to $160.25, which is the printed subtotal. Tax at 8% is $12.82, and $160.25 plus $12.82 equals the printed total of $173.07. Both checks hold; the document is done.

INV-3107 is flagged. Its line items are $89.00, $145.50, and $60.00, which sum to $294.50. The printed subtotal reads $319.50. The difference is $25.00, and it is the supplier's to explain: the extracted rows go into the spreadsheet exactly as read, the document is marked flagged with both figures and the difference, and no line item is touched. A $25.00 error caught here is a phone call. The same error carried into a quarter of cost records is a reconciliation project.

The preparation checklist

  • Gather every PDF in one place; one document per file where you can.
  • Name files by document number if the sender did not.
  • Separate born-digital PDFs from scans; they are read differently.
  • Write the field list before extracting: document number, date, line items, printed subtotal, tax, total.
  • Note which documents print totals; a document without them cannot be cross-checked.
  • Keep the originals untouched; extraction works on copies.
  • Keep OCR confidence scores with scanned pages for the spot-check pass.

When the pile is measured in hundreds of pages: this is the exact method our PDF data extraction service runs, at fixed prices by page count, with the cross-check report delivered for every document. The service page shows a flagged document in full, so you can see what the report looks like before you order.

Site