Updated
How to Extract Tables from a PDF (Measured on a Real Paper)
The test: one real PDF, two methods
We used the paper Attention Is All You Need (arXiv 1706.03762, 15 pages). It contains 4 tables, on pages 6, 8, 9 and 10, drawn without vertical lines, as in most papers and reports. Measured on 4 December 2026.
| Method | Real tables found | Columns kept | False tables | Time |
|---|---|---|---|---|
| pdfplumber 0.11.11, default settings | 2 of 4 (pages 9 and 10) | No: each row in 1 cell | 8 (figures on pages 13 to 15) | 1.9 s locally |
| pdfplumber, text strategy | table-like blocks on all 15 pages | Partly | Many: every page has one | 2.5 s locally |
| Plainprobe Document to Markdown | 4 of 4 (pages 6, 8, 9, 10) | Yes (4 to 12 columns) | 0 | 2.3 s conversion, 7 s whole run |
One PDF is not a benchmark of every layout: test on your own documents before choosing.
Option 1: pdfplumber in Python
Free and precise when tables have ruling lines:
import pdfplumber
with pdfplumber.open("report.pdf") as pdf:
for page in pdf.pages:
for table in page.extract_tables():
print(page.page_number, table[:3])For borderless tables, try page.extract_tables({"vertical_strategy": "text", "horizontal_strategy": "text"}), then filter out the blocks that are really paragraphs or figures. Camelot (stream mode) and Tabula offer similar choices.
Option 2: a converter that returns tables as rows
Plainprobe Document to Markdown takes the URL of a PDF, DOCX, PPTX or HTML file and returns the whole document as Markdown, with every table as a Markdown pipe table and, per page, as a list of rows ready for pandas or a spreadsheet. It costs $0.004 per document (first 50 pages included); failed documents are free.
Pitfalls to check whatever you use
- Exponents and subscripts: PDF text often stores them as small separate characters. In our test, 1020 came out as
1020and n2 asn2: check scientific notation by hand. - Merged header rows: two-level headers (for example BLEU split into EN-DE and EN-FR) become an extra row with empty cells.
- Figures detected as tables: grids in charts and attention maps look like tables to line-based tools.
- Scans: run OCR first, and verify numbers.
FAQ
Can I extract tables from a PDF for free?
Yes. Python libraries such as pdfplumber, Camelot or Tabula are free. They work best on tables drawn with ruling lines; on borderless tables (common in papers and reports) check the result, because tables can be missed or merged into one column.
Why does my PDF table come out as one column?
Most PDFs store text as positioned words, not as a table. A tool that only follows drawn lines sees no column borders on a borderless table and returns each row as a single cell. Use a word-position (text) strategy, or a converter that rebuilds columns from word positions.
Can I get the tables as JSON or CSV?
Yes. Convert the PDF to Markdown pipe tables or to a list of rows, then load the rows into pandas or a spreadsheet; each row becomes a list of cell strings.
What about scanned PDFs?
A scanned page is an image: it needs OCR first. Text recognition errors then flow into the table, so check numbers on scans by hand.