pdfblah.com

← All guides

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

Tips