Extract invoice tables from PDF to Excel

Extract invoice tables from a PDF to Excel in five steps: pick the best source, test text vs scan, import, rebuild line items and reconcile the line total.

See the PDF-to-Excel example

To extract an invoice table from a PDF to Excel, first use the most structured source you have (a supplier export or embedded invoice XML), and only then import the PDF itself: as text if the table contains selectable text, through OCR if the page is a scan. Whatever the route, accept the spreadsheet only when every invoice line item appears once and the line net amounts add up to the subtotal printed on the invoice.

A PDF is a presentation format: it stores positioned text or page images, not rows and columns. The work is therefore to pick a starting point, turn it into rows, and prove that the rows match the document.

How do you extract an invoice table from a PDF, step by step?

  1. Look for structured data first. Ask the vendor (supplier) for an item-level CSV or Excel export, or check whether the PDF carries embedded XML. An export with only invoice dates and totals does not help a line-level task.
  2. Test the PDF type. Select one description and its amount, copy them into a plain-text editor and search for an item reference. Readable text means a text-based PDF; nothing selectable means a scanned page that needs OCR.
  3. Import the table. For a text PDF, use your spreadsheet’s PDF import, if your version has one, or copy the table into a working sheet. For a scan, run OCR on a working copy and keep the original.
  4. Rebuild one row per line item. Remove repeated column headings and carried subtotals, join wrapped descriptions to their item, and keep document fields (supplier, invoice number, page) in their own columns.
  5. Reconcile. Compare the number of item rows with the items visible on the PDF, then compare the sum of line net amounts with the printed subtotal before tax.

If you need this routinely rather than once, you can turn a PDF invoice into Excel rows with line-level checks and start from rows that already carry their page reference.

InvoiceLineLab extracts invoice line items from PDF to Excel or CSV: each product or service becomes its own row, with description, quantity, unit, price, net amount and the source page beside it, so step 5 starts from rows you can check against the PDF.

Which method fits your invoice PDF?

Starting pointMethodWhat you still review
Item-level export or invoice XML availableUse the structured fileColumns present, units, credits, document context
Text-based PDF, simple tableSpreadsheet PDF import or copy-pasteRepeated headers, wrapped lines, numbers stored as text
Scanned PDF (image only)OCR on a working copyMisread characters, decimal marks, row grouping
Recurring invoices, mixed layoutsDedicated invoice line extractionFlagged values, page coverage, totals

For a hybrid e-invoice, the embedded XML can be the best source, but its content depends on the declared profile: check whether the Factur-X XML contains line items before relying on it. According to FNFE-MPE, the MINIMUM and BASIC WL profiles carry document-level data, while BASIC adds core line information.

For a scan, OCR creates actual text from page images, and the W3C technique asks you to check that all text was recognized in the correct reading order. Recognition gives you characters; it does not decide which row a continuation belongs to. The scanned or text PDF diagnosis explains how to test each page before choosing.

What does a raw PDF import look like on a fictional invoice?

The synthetic invoice below has five line items over two pages. The raw import returns nine rows, because layout became data.

Raw rowPageTextQtyUnit priceAmount (EUR)Decision
11Copy paper A4, box of 5 reams1024.90249.00Item 1
21Toner cartridge, black268.50137.00Item 2
31Archive boxes414.0056.00Item 3
41natural board, pack of 10Join to item 3
51Carried forward442.00Exclude
62Description / Qty / Price / AmountExclude (heading)
72Brought forward442.00Exclude
82Printed labels, 10% line discount318.0048.60Item 4
92Delivery9.00Item 5

All figures are invented. Checks: 10 × 24.90 = 249.00; 2 × 68.50 = 137.00; 4 × 14.00 = 56.00; 249.00 + 137.00 + 56.00 = 442.00, which matches the carried amount. Labels: 3 × 18.00 = 54.00, minus 10% (5.40) = 48.60.

  • Correct sum of line net amounts: 249.00 + 137.00 + 56.00 + 48.60 + 9.00 = EUR 499.60.
  • Summing the raw amount column with both carry rows: 499.60 + 442.00 + 442.00 = EUR 1,383.60.
  • With a fictional 20% VAT rate on the correct base: 499.60 × 0.20 = 99.92, so the total including tax is EUR 599.52.

Five item rows, one per printed item, and a line total equal to the invoice subtotal: that is the acceptance target. “Nine output rows” is not.

How do you extract line items, not only header fields?

Header fields (supplier, invoice number, date, total) are a handful of values per invoice; the item table is where rows wrap, split across pages and change layout from one vendor to the next. For analysis, purchase checks or a three-way match, you need the line items. Keep the two levels apart: one row per item, with the invoice number repeated beside it, and totals in a separate summary. The difference between invoice line items and header fields shows the column layout.

In Peppol’s invoice model, each invoice line has its own identifier, invoiced quantity, line net amount, item information and price. Those are useful column names for your sheet, even when the source is a PDF.

What should you check before using the Excel table?

Test each method on the same small sample rather than the cleanest invoice. Include a wrapped description, a multipage table, a credit note (credit memo), an item code with leading zeros and one poor scan.

Sample caseExpected resultReject or review if
Description wrapping onto a second lineOne item with its quantity and amountThe continuation becomes a new purchase
Table across several pagesEvery item once, with its pageHeaders or carried totals become items
Item with no printed quantityQuantity left blank and flaggedA zero or a guessed value appears
Item code with leading zerosCode kept as text“00451” becomes 451
Line discount or creditOriginal fields kept, sign explainedThe discount is applied twice
Unreadable scanned pageVisible exception naming the pageThe page silently yields zero items

Totals alone cannot prove completeness: a missing EUR 15.00 item and a duplicated EUR 15.00 item cancel out. Count items per page as well. For repeated headers and carried subtotals across page breaks, classify each boundary row before deleting it.

When is a dedicated extraction tool worth it?

For one short text invoice, a carefully checked copy-paste is often enough. A dedicated tool pays off when invoices recur, layouts vary and the time goes into cleanup and review rather than conversion. Compare routes on the whole task: setup, cleanup, review and export, plus the price on its stated billing unit (per document or per page). A route that converts in seconds but needs fifteen minutes of correction per invoice can cost more than a slower, cleaner one.

Before sending invoices to any service, check its documented handling and retention terms against your own requirements. InvoiceLineLab bills per PDF page on a single monthly plan, the synthetic invoice example shows the target rows with their review notes, and invoice data validation line by line lists the checks applied to each row.

Once the rows exist, reconcile the line totals with the amount payable: discounts, shipping, tax and prepayments sit at document level.

FAQ

Can Excel import a table directly from a PDF?

Some spreadsheet versions include a PDF import among their data import tools; availability depends on version and platform. It needs a text-based PDF and still requires cleanup of headers, wrapped lines and number formats.

Why does my PDF table land in one column in Excel?

The PDF stores positioned text, not cells. A simple paste loses the column boundaries; an import tool or a text-to-columns step has to rebuild them, and you should check alignment on every page.

How do I extract data from a scanned PDF invoice to Excel?

Run OCR on a working copy, then compare codes, quantities and decimal marks with the page image. Keep the original PDF and mark any page that could not be read.

Is matching the invoice total enough to validate the extraction?

No. Compare item counts per page and check boundary rows too: offsetting errors, such as one missing item and one duplicated item at the same price, leave the total unchanged.

Sources and further reading

Get started with InvoiceLineLab

Enter your work email to get access to InvoiceLineLab. No account or payment is created at this stage.

Submitting sends your email and visit context to our publisher’s infrastructure, named on the Privacy page. No account, payment or automatic email is triggered. Privacy.