Convert PDF Data to an XLSX Workbook
Converting PDF to XLSX means producing a genuine workbook — typed cells, worksheets, optionally formulas — from a document that stores only the printed appearance of its tables as positioned text. The conversion succeeds when each printed value lands in its own correctly typed cell, and fails subtly when numbers arrive as text or leading zeros vanish. This page focuses on the .xlsx end of the pipeline and on scriptable extraction: Camelot's command line and accuracy reports, Tabula's batch JAR, and Excel's Power Query importer.
Table detection plus workbook generation requires geometric analysis engines and spreadsheet writers that cannot run credibly as in-page JavaScript — and a converter that silently mistypes financial data is worse than none. The scriptable tools below extract verifiably, including in bulk.
Disclosure: this page contains affiliate placeholder links. If they were live, we could earn a commission at no extra cost to you.
AFFILIATE PLACEHOLDER: Recommended desktop PDF suite (placeholder link)
How to convert PDF to XLSX (step by step)
Method 1: Camelot on the command line (free, scriptable, with accuracy scores)
- Install Python 3, then run
pip install "camelot-py[base]" openpyxl. - Extract:
camelot -p all -f xlsx -o out.xlsx lattice report.pdf— swaplatticeforstreamwhen tables have no ruled borders. - In the Python API,
camelot.read_pdf()returns aparsing_reportper table with an accuracy score; treat anything under about 90 as needing manual review. - Open the .xlsx and verify types: amounts as numbers, dates as dates, and codes with leading zeros still text.
The accuracy report is the reason to prefer Camelot for anything financial — it tells you which tables to distrust instead of leaving you to find out later.
Method 2: Tabula's command-line JAR for batches
- Use the Tabula desktop app once to draw selections around your tables, then save the template (a JSON of page regions).
- Run
java -jar tabula.jar --pages all --lattice --format CSV --outfile out.csv report.pdf, or loop it over a folder of identically laid-out PDFs with the saved template. - Open the CSVs in Excel, importing code-like columns as text, and save as .xlsx.
The template trick is what makes Tabula shine on recurring documents — monthly statements with an identical layout extract unattended once the regions are defined.
Method 3: Excel's Power Query, saved as .xlsx
- In Excel (Microsoft 365/2021+, Windows) use Data → Get Data → From File → From PDF.
- In Power Query, set every column's data type explicitly — this is where "00420" is protected as text and "1,204.50" becomes a real number.
- Load and save the workbook; the query stays refreshable. Full walkthrough on the PDF to Excel page.
How it works
An .xlsx file is a ZIP of XML parts: xl/worksheets/sheet1.xml holds rows of <c> cell elements, each with an address, a type, and a value; xl/sharedStrings.xml deduplicates text; xl/styles.xml defines number formats. Crucially, a cell's stored value and its displayed form are different things — a date is really a serial number (August 5, 2026 is 46239) plus a format, and "1,204.50" is the double 1204.5 formatted with a thousands separator. None of that machinery exists in a PDF, which kept only the formatted strings drawn at page coordinates. So "PDF to XLSX" is really two problems: geometry (rebuilding the grid) and typing (turning display strings back into values).
The geometry step is shared with any table extraction: lattice-style tools intersect the drawn ruling lines to reconstruct cells and drop each text fragment into the cell rectangle that contains it, while stream-style tools cluster fragments by shared baselines (rows) and aligned edges separated by consistent whitespace gutters (columns). The typing step is where .xlsx-specific quality is won or lost. A good pipeline parses locale-aware numbers (1.204,50 versus 1,204.50), maps date strings onto serial numbers without swapping day and month, writes genuine <c t="n"> numeric cells rather than numbers-as-text, and deliberately keeps identifier columns as strings so 00420 does not silently become 420.
Formulas are unrecoverable by definition — the PDF holds only each cell's printed result — but that limitation is also your best verification tool: after import, re-create the obvious totals with SUM() and compare them against the totals printed in the PDF. Agreement to the cent is strong evidence the extraction placed and typed every value correctly; disagreement points you at the exact rows to inspect.
Worked example: 12 monthly reports into one workbook
A year of monthly expense reports (12 PDFs, 2–4 pages each, 4.6 MB total, ruled tables) needed to become a single .xlsx for analysis. A ten-line Camelot script with flavor="lattice" extracted 41 tables in 58 seconds; the parsing reports showed 38 tables at accuracy 97–100 and flagged 3 at 71–84 — all three from the two months whose reports used a borderless summary table, which were re-run with flavor="stream" and one columns= hint. Writing each month to its own worksheet via openpyxl produced a 289 KB workbook. Verification formulas (SUM() per month against each PDF's printed total) matched in 11 of 12 months; the mismatch traced to one OCR-free but oddly encoded en-dash minus sign that had turned a negative adjustment of −150.00 into text, fixed in one cell. Total time: about 25 minutes, most of it writing checks rather than extracting.
Frequently asked questions
How do I convert a PDF to XLSX rather than CSV?
Use a tool that writes workbooks directly: Camelot with -f xlsx, Acrobat's Excel export, or Excel's own From PDF importer. CSV is fine as an intermediate, but it cannot hold multiple sheets, cell types, or leading zeros, so exporting straight to .xlsx skips a lossy step.
Can I batch convert many PDFs to XLSX automatically?
Yes, with a script: loop camelot -p all -f xlsx -o "${f%.pdf}.xlsx" lattice "$f" over the folder, or use Camelot's Python API to add validation. Tabula also ships a command-line JAR, tabula.jar, that batch-exports selections defined in a saved template.
Why do leading zeros disappear when PDF data reaches Excel?
Excel converts anything that looks numeric into a number, so an account code like 00420 becomes 420. Import the column as text — easy in Power Query or when loading a CSV through the legacy import wizard — or format the column as text before pasting.
What is the difference between lattice and stream extraction?
Lattice mode rebuilds the table from its drawn cell borders, which is very reliable when borders exist. Stream mode infers columns from whitespace alignment, which is the only option for borderless tables but more easily confused by wrapped text.
How accurate is automated PDF table extraction?
On digitally created PDFs with ruled tables, lattice extraction routinely places over 99 percent of cells correctly; borderless and multi-line tables do worse. Always reconcile a few totals against the printed PDF before trusting the workbook.
Will one PDF page become one worksheet in the .xlsx?
It depends on the tool: Camelot writes one sheet per detected table, while Acrobat groups content page by page. A table that continues across pages arrives as several pieces either way, and you append them afterwards in Excel or Power Query.