How to Extract Tables from a PDF
Copy a table out of a PDF and paste it into Excel, and you usually get one long column of jumbled values — or nothing at all. That is not your fault: PDFs do not actually store tables. This guide compares the 4 methods that work, from quick copy-paste tricks to tools that handle scanned documents, so you can pick the right one for your file.
Why PDF tables are so hard to extract
A PDF has no concept of a table. What looks like rows and columns is just individual text fragments positioned at x/y coordinates, sometimes with drawn lines between them. The "table" exists only in your eyes — the file stores no cells, no rows, no header.
Every extraction method is therefore reconstruction: an algorithm guessing which text fragments belong to the same cell, which cells form a row, and where columns begin. Ruled tables (with visible grid lines) are easier to reconstruct; whitespace-separated tables, merged cells, multi-line cells, and multi-page tables are where most tools fail.
Scanned PDFs add another layer: the page is a photograph, so there is no text at all until OCR runs. Pick your method based on which of these problems your document has.
Method 1: Copy-paste into Excel (quick, small ruled tables)
For a simple, well-ruled table, select it in your PDF viewer, copy, and paste into Excel or Google Sheets. If everything lands in one column, use Data → Text to Columns (Excel) or Data → Split text to columns (Sheets) to re-split the values.
A useful variation: paste into a plain-text editor first to see what structure survived. If the values are separated by consistent spaces or tabs, Text to Columns will recover the table; if the rows are interleaved or truncated, no amount of splitting will fix it.
When this works: single-page ruled tables with short cell values. When it fails: merged cells, multi-line text inside cells, numbers with thousands separators being split apart, and any scanned document.
Method 2: Excel Power Query or Word (built-in, no extra tools)
Modern Excel can import PDF tables directly: Data → Get Data → From File → From PDF. Excel scans the document, lists every table it detects, and shows a preview — pick the table, click Load, and it lands as a proper spreadsheet range. This is the best built-in option on Windows (it requires a Microsoft 365 or 2021+ license and is not available in Excel for Mac in all versions).
Word can also open PDFs directly (File → Open → select the PDF). It converts the document to an editable file, and simple tables usually survive as real Word tables you can copy into Excel.
When this works: digitally-created PDFs with clearly ruled tables. When it fails: whitespace-only tables are often missed or mis-split, multi-page tables import as separate fragments, and scanned PDFs produce nothing — Power Query does not OCR.
Method 3: Python libraries — camelot, tabula-py, pdfplumber (developers)
If you need to extract tables from many PDFs programmatically, the established open-source options are camelot (best on ruled tables, two detection modes), tabula-py (a wrapper around the Java Tabula engine, solid on consistent layouts), and pdfplumber (lower-level control over words, lines, and rectangles — best when you need custom logic).
A minimal camelot example: pip install camelot-py[cv], then tables = camelot.read_pdf("report.pdf", pages="all") and tables[0].df gives you a pandas DataFrame. Export with .to_csv() or .to_excel().
The catch: each library has a layout style it favors, and real-world documents mix styles. Expect to tune settings per document family (flavor="stream" vs "lattice" in camelot, area hints in tabula), and none of them handle scanned PDFs — you would need to run OCR first and lose the layout in the process.
For a broader look at PDF parsing in Python beyond tables, see our guide on converting PDF to Markdown in Python.
Method 4: AI-powered extraction (scanned PDFs, mixed layouts, scale)
The newest approach uses document-understanding models that read the page the way a person does — detecting table structure from the visual layout rather than relying on ruling lines or coordinate heuristics. This is the only method class that handles scanned documents, photographed pages, and inconsistent layouts in one pass.
ParseJet works this way: upload a PDF at parsejet.com/tools/pdf-to-markdown and tables come back as clean Markdown tables in reading order — scanned pages are OCRed automatically. If you want data instead of text, the API returns the parsed document as structured output (see the PDF to JSON tool), and one POST request per file makes it practical for batch pipelines.
When this works: scanned and photographed documents, mixed ruled/whitespace layouts, and batch processing where per-document tuning is impossible. The trade-off: it is a hosted service — for a one-off table on a clean PDF, Method 1 or 2 is faster.
Which method should you use?
One small ruled table, one time: copy-paste (Method 1), falling back to Excel Power Query (Method 2) if the paste jumbles.
Recurring reports with the same layout: Power Query for spreadsheet users, camelot or tabula-py (Method 3) for developers — a one-time setup pays off on every future file.
Scanned documents, photos, or messy mixed layouts: AI extraction (Method 4) is realistically the only option that does not involve retyping.
Hundreds of documents with varying layouts: Method 4 via API — per-document tuning of Method 3 libraries does not scale past a handful of layout families.
Extract tables from any PDF — including scans
Upload a PDF and get every table back as clean Markdown, in reading order, with scanned pages OCRed automatically. Free to try, no signup.
Try PDF to MarkdownFrequently asked questions
How do I extract a table from a PDF to Excel?
Try Excel’s built-in importer first: Data → Get Data → From File → From PDF, then pick the detected table. If Excel misses or mangles it — common with whitespace-separated or scanned tables — extract via an AI tool like ParseJet and paste the Markdown table into Excel.
Can I extract tables from a scanned PDF?
Only with OCR-capable tools. Copy-paste, Power Query, and Python table libraries all require real text. AI-powered extractors OCR the page first and then reconstruct the table — upload the scan to ParseJet and the table comes back as text.
What is the best Python library for PDF table extraction?
camelot for ruled tables, tabula-py for consistent report layouts, pdfplumber when you need custom low-level logic. All three need per-layout tuning and none handle scanned pages, so pipelines with messy input usually end up calling a parsing API instead.
Why does my pasted table end up in one column?
Your PDF viewer serialized the table row-fragments as plain lines with spaces, and Excel pasted each line into one cell. Use Text to Columns to re-split, or use a method that reconstructs the table structure (Power Query or an extraction tool).
How do tables with merged cells extract?
Badly, in most tools — merged cells break the row/column grid every heuristic relies on. Structure-aware extraction handles them best; expect to verify merged regions manually whichever method you use.
Can I extract tables from many PDFs automatically?
Yes — POST each file to a parsing API. With ParseJet, /v1/parse/auto/file returns the document with tables as Markdown (or structured JSON), and a free API account includes 300 credits per month.
Related tools
PDF to Markdown Converter
Convert PDF to Markdown online for free. Preserves headings, lists, tables, and code blocks. No signup required — try it instantly or automate via API.
PDF to JSON Converter
Convert PDF to JSON online for free. Get text, title, and metadata as structured JSON — ready for your app, database, or AI pipeline. API included.
Extract Text from PDF
Extract text from PDF files online for free. Supports scanned documents, multi-page PDFs, and complex layouts. No installation needed — works in your browser.
Related guides
How to Convert PDF to Markdown in Python
Convert PDF to Markdown in Python: PyMuPDF4LLM, Marker, MarkItDown, and a hosted API compared — with working code, accuracy notes, and when to pick each.
How to Copy Text from a PDF
Learn 4 proven ways to copy text from any PDF file — regular, scanned, or protected. Includes free methods, step-by-step instructions, and troubleshooting tips.