Get the tables out of a PDF
The numbers you need are sitting in a PDF table, and retyping them is how errors are born. extract --tables detects the tables and writes CSV that opens straight in Excel. One command, on your machine; the invoices never visit anyone's server.
How to do it
pip install pdfblah
# every table, one CSV (tables separated by a blank row)
pdfblah extract statement.pdf --tables -o statement.csv
# one file per table instead
pdfblah extract report.pdf --tables -o tables/
# -> tables/table-p3-1.csv, tables/table-p7-1.csv, ...
# just look first
pdfblah extract statement.pdf --tables
# a folder of invoices
for f in invoices/*.pdf; do
pdfblah extract "$f" --tables -o "csv/${f##*/}.csv"
done
What to expect
- Detection is structural, not AI. Ruled tables and cleanly aligned columns in the real text layer come out reliably, with cell values exactly as they appear (commas and quotes survive, because CSV is written properly).
- Digital PDFs only, by themselves. A scanned table is a photograph; run OCR first and extraction reads the recognized layer. The error message says exactly that instead of returning an empty file.
- "No tables" is an answer. If nothing table-shaped exists in the text layer, you are told, not handed a guess.
Tips
--pages 3-5limits detection to the pages you care about, which also avoids picking up layout grids elsewhere.- Excel opens CSV directly; for a real .xlsx, File → Save As from there. The data is the hard part, and that is what this does.
- Complex visual layouts (merged cells, no rules, decorative spacing) can confuse structural detection. Check the row count in the report against the page.