Blog βΊ
How to extract tables from a PDF to Excel (and why it keeps going wrong)
A supplier's price list, a bank statement, a page of lab results, a 40-page annual report: the numbers are right there, and yet getting them into a spreadsheet eats an afternoon. Here is what actually works for which kind of PDF, why each method fails, and how to check the result before anyone builds a decision on it.
First, find out which kind of PDF you have
This decides everything. Open the PDF and try to select a single word in the table with your mouse.
- You can select the text β it's a text PDF. The numbers exist as characters, and every method below can read them. The problem is only working out which characters belong to which cell.
- The whole page selects as one image β it's a scanned PDF. There is no text at all, just a picture. You need OCR (text recognition) first, and everything you get out is a best guess that must be checked.
A surprising number of "PDF to Excel doesn't work" complaints are scanned PDFs run through a tool that only handles text. Check this before you blame the tool.
1. Copy and paste (30 seconds, works more often than you'd think)
Select the table in your PDF viewer, copy, paste into Excel or Google Sheets. With a clean, single-page text PDF this often lands in the right columns, especially from Acrobat, Edge or Chrome's viewer.
When it fails: everything lands in one column, or one cell per line. Two rescues:
- In Excel, select the column and use Data β Text to Columns, choosing "Delimited" with a space or tab. This works when the cells contain no spaces themselves (numbers, codes, dates).
- Paste into a plain text editor first, then into the spreadsheet. This strips the formatting that sometimes confuses Excel.
Don't spend more than five minutes on this. If it's a mess, move on.
2. Excel's built-in PDF import (the best free option for text PDFs)
Excel can read tables directly from a PDF, and most people don't know it's there: Data β Get Data β From File β From PDF. It is available in Microsoft 365 on Windows and in recent versions of Excel for Mac. Pick the file, and a navigator lists every table Excel detected, per page, with a preview. Choose one, click Load.
Two things make this the strongest free option:
- It's a Power Query import, so the steps are saved. When next month's statement arrives with the same layout, you replace the file and click Refresh.
- You can pick "Page 003" instead of "Table 002" when the detected table is wrong, and clean it up with Power Query's split, remove-rows and change-type steps rather than by hand.
When it fails: tables without ruling lines get split or merged, multi-line cells become extra rows, and it does nothing for scanned PDFs. The preview shows you the problem before you load, so you lose nothing by trying.
3. Adobe Acrobat (paid, handles scans)
Acrobat Pro's Export PDF β Spreadsheet is the most polished single button, and it runs OCR on scanned pages as part of the export. It's the right answer if you already pay for Acrobat and you're doing this weekly. It's not worth a subscription for one file: the free online converters (Adobe's included) work the same way but require uploading the document, which for a bank statement or a customer list you may not be allowed to do.
4. Tabula (free, open source, nothing leaves your computer)
Tabula is a small tool that runs locally in your browser. You open a PDF, draw a rectangle around the table, and it exports CSV. Its strength is the rectangle: you decide exactly what counts as the table, which fixes most of the "it merged the footnotes in" problems automatically. It has two extraction modes, Lattice for tables with ruling lines and Stream for tables aligned only by whitespace; if one produces nonsense, try the other.
When it fails: it needs Java, it's text PDFs only, and it's one table at a time. For fifty pages you want the next option.
5. Python, for anything repeated or large
If the same kind of PDF arrives every week, or you have a hundred of them, a short script beats every GUI. Three libraries cover almost all cases:
- pdfplumber β reads the text with its coordinates and has a good
extract_tables(). The best default. - Camelot β the same lattice/stream idea as Tabula, with a per-table accuracy score you can use to flag pages for manual review.
- pymupdf (fitz) β very fast, with
page.find_tables()in recent versions; the right pick for large volumes.
import pdfplumber, csv
with pdfplumber.open("statement.pdf") as pdf, open("out.csv", "w", newline="") as f:
w = csv.writer(f)
for page in pdf.pages:
for table in page.extract_tables():
w.writerows(table)
For scanned PDFs, run OCR first: ocrmypdf in.pdf out.pdf adds a text layer using Tesseract, after which the same script works. Expect OCR to misread some digits (1/7, 0/8, 5/6 are the usual suspects), which brings us to the part everyone skips.
Why it goes wrong: the six usual suspects
- Merged cells and multi-line cells. A product description that wraps onto two lines becomes two rows, with the price on the first and an empty row after. Fix: sort out which rows have an empty key column and merge them upward.
- Numbers that arrive as text. Thousands separators, currency symbols, trailing minus signs ("1.250,00-") and non-breaking spaces make Excel treat the number as a label; your SUM is silently wrong. Fix: Text to Columns with the right locale, or in Power Query, Change Type using Locale.
- German vs. English decimals. "1.250,00" is one thousand two hundred fifty in Berlin and one point two five in Boston. Excel guesses from your system locale, not the document's. Always set it explicitly.
- Tables that continue across pages. Repeated headers appear as data rows in the middle of your data, and page footers ("Page 3 of 12", running totals) slip in. Fix: filter rows whose first cell equals the header text.
- Columns aligned by whitespace only. Without ruling lines, tools guess column boundaries from gaps. A single wide value pushes everything after it one column right on that row. Tabula's rectangle or Camelot's stream mode with explicit column positions fixes this.
- Scans. Skew, low resolution and stamps over the table produce plausible-looking wrong digits. OCR confidence isn't shown in the output, so nothing looks wrong.
Check it before you trust it
Whatever method you use, do this before the spreadsheet goes anywhere:
- Recompute a total the PDF already shows. Statements, invoices and reports almost always print a subtotal or total. If your SUM of the column doesn't match it exactly, something is missing, doubled or misread. This single check catches most extraction errors.
- Count the rows against the PDF: 47 line items in, 47 rows out.
- Check the row with the widest cell (the longest description). It's the most likely to have shifted columns.
- Look at the first and last row of every page boundary.
- Keep the PDF's page number in a column when you script it, so a wrong value can be traced back in seconds.
Which one should you use?
- One clean table, once: copy-paste, then Excel's From PDF.
- A monthly statement with the same layout: Excel's From PDF, saved as a refreshable query.
- A confidential document you can't upload: Tabula or Excel (both run locally).
- Fifty files, or every week forever: Python with pdfplumber.
- Scanned pages: Acrobat if you have it, otherwise ocrmypdf then any of the above, and check every total.
Or let pdfagents.ai do it, in your browser
Drop the PDF and say βput the tables into Excelβ or βpull the tables into CSVβ. Tables are found from aligned columns, wrapped lines are merged back into their row, and in the Excel file numbers are stored as real numbers whether the document writes 1.250,00 or 1,250.00. Nothing is uploaded. It works on text PDFs; for a scan, say βmake it searchableβ first. Then run the checks above on the result: we would rather you verify a total than trust us. Downloads are free.
PDF tables to Excel β β¦or to CSV