---
title: "Extract Tables from PDF and Images: Table Extraction Guide"
description: "Extract tables from PDF files, scans and images with Excel, Python, OCR APIs or document AI. Then check every row before the data reaches your systems."
url: https://www.docsumo.com/blog/table-extraction-from-pdf
updated: 2026-10-21
---

# How to extract tables from PDF files, scans and images

For finance and operations teams that pull line items and transactions out of PDFs, and for the developers who build that step. Pick a method by file type and volume, then check the rows it returns.

[Amit Timalsina](https://www.docsumo.com/blog-authors/amit-timalsina) · Updated Oct 21, 2026 · 10 min read

![Illustration of an invoice line-item table extracted from a PDF into a structured table](https://www.docsumo.com/blog/images/table-extraction-from-pdf-hero.webp)

## Key takeaways

- To **extract tables from PDF** files, match the method to the file. Excel and free Python libraries read PDFs made by software, which store their own text. Scans and photos first need OCR (optical character recognition) to read the characters.
- **Table extraction** happens in two stages. **Table detection** finds where the table is, and **table structure recognition** works out which row and column each value belongs to.
- The hard cases are **merged cells, borderless layouts, tables that span pages, poor scans and a different layout from every sender**.
- **Tables that run across pages** have to be joined into one. Excel's PDF import joins similar tables on consecutive pages by default. Most Python libraries leave that step to your code, but Camelot 2.0 can join them with one call.
- Extraction isn't finished until the table is **validated**. Rows should add up to the total, balances should reconcile, and uncertain cells should go to a person.

To **extract tables from PDF** files, use a tool that finds each table and rebuilds its rows and columns. Excel and free Python libraries read PDFs made by software, but scans and photos first need OCR to read the characters. Tables that arrive every day from many senders also need checks and a person to review uncertain cells.

## How to extract tables from a PDF

Start with the file, because it decides whether you need OCR. Try to select a word in the PDF. If you can, the file has a text layer. That's the text the software stored when it made the PDF. If you can't, the page is a picture.

### Native PDFs

Made by software, with a text layer, so tools read the characters and their positions directly.

### Scanned PDFs

A picture of a page with no text layer. OCR reads the characters first, and its errors carry into the table.

### Images and photos

Screenshots, phone photos and faxes. They work like scans, but they also have tilted pages, shadows and uneven light to fix.

Then pick the method that fits how many tables you have and who will run it.

| Your situation | Method | What it reads | Tables across pages |
| --- | --- | --- | --- |
| Tables arrive every day from many senders | A document AI platform such as Docsumo (our product) | Any document type, scans and handwritten text included | Joined into one table, with the headers mapped |
| Scans and photos, in your own code | A cloud OCR API such as Amazon Textract, Azure Document Intelligence or Google Document AI | Scans, photos and PDFs | Azure's docs say to join the pages into one table after Azure reads them |
| PDFs with a text layer, in your own code | A Python library such as Camelot, pdfplumber or PyMuPDF | PDFs with a text layer; Camelot reads scans only with its ML and OCR add-ons | Camelot 2.0 joins them with stack_contiguous(); with the others, your code does |
| A few tables, no code | Excel for Microsoft 365 on Windows, Data > Get Data > From File > From PDF | PDFs with a text layer; Microsoft's docs describe no OCR step for scans | Similar tables on consecutive pages are joined by default |
| A few tables, some of them scanned | Adobe Acrobat, exporting to Excel | PDFs with a text layer, and scans with text recognition turned on | You choose a worksheet per table, per page or for the whole document |

Tabula is a free desktop app for the same job. You draw a box around each table and export it as CSV or Excel. It reads PDFs with a text layer only, and its last release came out in June 2018.

## What is table extraction?

Invoices, bank statements, rent rolls and claim forms keep their most useful data in tables. That means line items and transactions, or units and charges. A PDF only stores instructions such as "put this text here, draw this line there". The file does not record which text belongs to which row or cell. Table extraction works out the rows and columns again. The table data inside the PDF then comes out as rows and columns, with each value in the right cell.

![An invoice table detected on the page (table detection), split into rows and columns (table structure recognition), and output as a clean table of description, price, quantity and amount (table extraction)](https://www.docsumo.com/blog/images/table-extraction-from-pdf-1.webp)

**Table detection** finds where each table sits on the page. **Table structure recognition** then finds the rows and cells inside it, including headers and merged cells. On a scan or a photo, OCR has to read the characters before either step can start.

## Why tables are hard to extract

Five things make simple extraction tools fail.

### Merged cells and nested headers

A header that covers several smaller columns, or a small table inside one cell, makes simple tools put values in the wrong column.

### Tables that span pages

Tools that read one page at a time don't link the rows on page 2 to the header on page 1.

### Borderless layouts

The table has spaces instead of lines between cells, so columns that sit close together get merged.

### Scan quality

Blur, tilted or rotated pages and low resolution make OCR misread characters. Every later step then works with those mistakes.

### A different layout from every sender

One vendor's invoice has 5 columns and the next has 8. Templates made for one layout stop working as you add senders.

> **Docsumo for OCR & IDP**: [The Docsumo platform](https://www.docsumo.com/platform)
>
> Document AI, Case Management and Document Workflows in one product.

## How table extraction works

Whatever the method, the pipeline is the same. Get the text, find the table, rebuild its grid, then clean and check the result.

Native PDFs, Scanned PDFs, Images and photos → Table AI: 01 OCR if needed, 02 Detect the table, 03 Recognize rows and columns, 04 Map headers and clean rows, 05 Validate → **CSV, Excel, JSON or your system**

*From a page to a usable table*

Tools differ most in the last two steps, cleaning and validation. Cleaning means removing subtotals and repeated headers, joining tables that continue across pages, and matching each column to a field in your system. Validation means checking that the numbers add up.

## Table extraction techniques

There are four main ways to extract tables. Each newer method was built to fix the limits of the one before.

### Rules and templates

Ruling lines, spacing and header words such as Qty and Amount mark out the table; every new layout needs new rules.

### Machine learning

A program learns which parts of a page are tables. It uses signals an engineer chooses, such as lines, how closely text is packed and whether text lines up in columns.

### Deep learning

The model learns the signals that mark a table from many examples, so no engineer has to choose them. [CascadeTabNet](https://arxiv.org/abs/2004.12629) (2020) finds tables and their cells in one model. Microsoft's [Table Transformer](https://arxiv.org/abs/2110.00061) learned from nearly one million tables taken from scientific articles.

### LLMs and vision-language models

Large language models (LLMs) read text, and vision-language models read images and text together. Both read the whole table with the words around it, so they can fill in a missing header. They cost more and can return values that aren't on the page.

| Criteria | Rule-based | Machine learning | Deep learning | LLM and vision |
| --- | --- | --- | --- | --- |
| Training data | None | Labeled examples | Large labeled sets | None to start; examples help |
| New layouts | New rules each time | Moderate | Good, if trained on similar documents | Good |
| Main risk | Breaks on layout changes | Feature upkeep | Weak on unfamiliar document types | Values that aren't on the page |
| Cost to run | Very low | Low | Moderate | Highest |

In daily use, teams often combine these methods. The software gives each value a confidence score. That score and your validation rules decide which cells a person reviews.

## How to join a table that runs across pages

A long table doesn't fit on one page. A bank statement's transactions, a rent roll or a loss run can fill several pages. A tool that reads one page at a time returns one table per page. The rows on page 2 then sit apart from the header on page 1.

Joining them takes three steps. First, spot the continuation, which may be the same columns, a repeated header or a row cut off at the page break. Next, carry the header forward and drop the header rows that repeat on each page. Last, count the rows. Extra rows mean repeated headers were kept, and missing rows mean a page wasn't joined.

Excel's PDF import joins similar tables on consecutive pages by default. In code, Camelot 2.0 can do the joining for you. Its stack_contiguous() call joins tables that continue across pages when they have the same number of columns. A first-row option also drops the header that repeats on each page.

With the other Python libraries, your own code does the joining. Azure's OCR API leaves this step to you as well. Its docs say to join the pages into one table after Azure has read them. Docsumo joins a table that runs across pages into one table and maps its headers. A long statement then comes out as one list of transactions.

## How to extract a table from an image or a scan

A photo or screenshot has no text layer, so OCR comes first. Pick the route that fits how often you do it.

1. **One table, now**: Excel's Data > From Picture turns an image or a screenshot into cells and asks you to review them before inserting. That's where to catch misreads.
2. **A script you control**: The Python library [img2table](https://github.com/xavctn/img2table) finds tables in images and PDFs, borderless ones included, with an OCR engine such as Tesseract, PaddleOCR or EasyOCR.
3. **Many images, every day**: A document AI platform straightens tilted pages, reads the table, scores each cell and sends the uncertain ones to a person.

Whatever the route, straighten the image, crop to the table and use the highest resolution you have. For a scanned PDF, Acrobat's export to Excel can read the page once its text recognition setting is on.

## Python libraries and OCR APIs for PDF tables

Free Python libraries read the text layer well. Each one returns the tables page by page. Camelot 2.0 can join tables that run across pages, while the others leave that to your code. With every library, your code maps the headers and checks the totals.

| Library | Best for | Scanned PDFs |
| --- | --- | --- |
| Camelot | Ruled tables (lattice) and whitespace-separated tables (stream) in native PDFs, with an accuracy score for each table; since version 2.0, stack_contiguous() joins tables across pages | Only with its optional ML and OCR add-ons |
| tabula-py | Simple, well-structured tables; a Python wrapper for tabula-java (needs Java) | No |
| pdfplumber | Detailed access to characters, lines and tables through find_tables and extract_tables | No; it has no OCR |
| PyMuPDF | Page.find_tables(), with line- and text-based strategies and export to pandas | Not on its own |
| img2table | Tables in images and PDFs, including borderless tables | Yes, with an OCR engine you choose |

Cloud OCR APIs read scans and photos as well. [Amazon Textract](https://docs.aws.amazon.com/textract/latest/dg/how-it-works-tables.html) returns each table as cells with a row and column number. It also marks merged cells and column headers, and it finds table titles and footers. [Azure Document Intelligence](https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/prebuilt/layout?view=doc-intel-4.0.0) marks column headers and reads rotated tables. Google's [Form Parser](https://docs.cloud.google.com/document-ai/docs/form-parser) handles only simple tables, where no cell spans two or more rows or columns. Each API's docs describe the table structure it returns. You build the checks on the numbers yourself, such as totals that add up.

If you send the tables to a large language model (LLM), export them as Markdown, a plain-text format. Camelot and PyMuPDF can both do that. For a worked pdfplumber example, see [how to extract data from PDF](https://www.docsumo.com/blog/extract-data-from-pdf).

## How to validate extracted table data

Pulling the table out is only half the work. Checking it is what makes the data safe to use. A bank statement shows how the checks work. Harbor Street Bakery's July statement from First Midwest Bank has a transactions table of 142 rows. Each row has a date, a description, an amount and a running balance.

The first row is a Square deposit of 4,812.30 on July 2. It takes the balance from 42,180.55 to 46,992.85. A check repeats that sum on every row. If an amount was misread, the check fails on that row. At the end, the 42,180.55 opening balance plus 88,412.10 in deposits, minus 91,686.44 in withdrawals, has to equal the 38,906.21 closing balance.

**Account**

| Field | Extracted value |
| --- | --- |
| Account holder | Harbor Street Bakery LLC |
| Address | 118 Harbor St, Portland, ME |
| Bank name | First Midwest Bank |
| Account number | •••• 4821 |
| Account type | Business checking |
| Statement period | 2026-07-01 → 2026-07-31 |

**Balances**

| Field | Extracted value |
| --- | --- |
| Opening balance | 42,180.55 |
| Total deposits | 88,412.10 |
| Total withdrawals | 91,686.44 |
| Closing balance | 38,906.21 |
| Transaction count | 142 |

**Transactions**

| Field | Extracted value |
| --- | --- |
| Date | 2026-07-14 |
| Description | ACH DEPOSIT STRIPE PAYOUT |
| Amount | +3,284.10 |
| Debit / credit | Credit |
| Running balance | 51,902.44 |
| Category | Card processor payout |

*A bank statement's transactions table, read row by row. Each row keeps its date, description, amount and running balance, so every row can be checked.*

- **Rows add up to the total**: Line items that add up to 10,050 don't match an extracted total of 10,500. The record goes to review before it reaches your ERP or accounting system.
- **Balances reconcile**: On a bank statement, the opening balance plus credits minus debits equals the closing balance.
- **Documents agree**: Invoice lines match the purchase order; rent roll totals match the operating statement.
- **Every page is there**: Page counts and running totals confirm that a multi-page table isn't missing rows.
- **Uncertain cells go to a person**: High-confidence rows go through; the rest go to review.

## How to choose table extraction software

The methods table at the top gives you a shortlist. Before you commit, test each tool on your own files.

1. **Use your worst files**: Merged headers, borderless tables, tables across three or more pages, rotated pages and poor scans. Clean samples make every tool look good.
2. **Score cells, not documents**: Count right values and missed cells. A tool can find every table and still drop rows.
3. **Score the structure**: A right value in the wrong column is still wrong. The [TEDS](https://arxiv.org/abs/1911.10683) score compares the extracted table's structure and content with the original.
4. **Count rows on long tables**: Extra rows mean repeated headers were kept; missing rows mean a page wasn't joined.
5. **Count the fixes**: How many cells a person had to correct is the number that matters in production. More in [how to measure OCR accuracy](https://www.docsumo.com/blog/ocr-accuracy).

**What we'd do.** Don't rely on the accuracy figure on any vendor's page, ours included. Run each tool on the same set of your own worst files. Then count how many cells a person had to fix. That count reflects your own layouts, scan quality and multi-page tables, which no published number can.

## How Docsumo extracts tables

Docsumo's [Document AI](https://www.docsumo.com/platform#document-ai) reads the tables in documents such as [invoices](https://www.docsumo.com/solutions/documents/invoices), [bank statements](https://www.docsumo.com/solutions/documents/bank-statements) and the rent rolls used in [CRE underwriting](https://www.docsumo.com/solutions/use-cases/cre-underwriting). It reads any document type, including scans and handwritten text. Tables that run across pages are joined into one table, with the headers mapped. On bank statements, it checks each transaction against the statement's running balance.

Values the model is unsure about go to a reviewer, who can click each one to see its source line on the page. The rows reach your systems through the [API and webhooks](https://www.docsumo.com/integrations) or an Excel export. Docsumo's Data Table also gathers the data from every document of one type into one table, which you can export to CSV or Google Sheets. Docsumo is built for large volumes of business documents. For a single table from a research paper, a free library or Excel is enough.

**Video**: [Extracting complex tables with Docsumo's AI Table Assist](https://www.youtube.com/watch?v=bnOO5HIe5TM)

- **99%** field-level accuracy across 250+ document types
- **95%+** of documents processed straight through, without manual review

## How many cells did your reviewers have to fix?

If reviewers correct a few cells a week, the tool reads your tables and the checks catch the rest. If they retype whole rows, the tool isn't splitting your tables into the right rows and columns. Look at those tables for merged cells, page breaks and new sender layouts. Those are the files to bring to a demo or a trial.

[Book a demo](https://www.docsumo.com/book-a-demo) with a few of your own documents, or [start a free trial](https://www.docsumo.com/free-trial).

## Frequently asked questions

### What is table extraction?

Table extraction finds the tables in a PDF, scan or image. It turns them into structured rows and columns for a spreadsheet, database or business system. OCR alone returns the characters. Table extraction also works out which row and column each value belongs to.

### How do I extract a table from a PDF?

If the PDF has a text layer, Excel's PDF import or a Python library such as Camelot or pdfplumber can pull the table out. A scanned PDF needs OCR first. If you get many PDFs from many senders, use a document AI platform. It connects to your systems through an API and sends unsure values to a person to review.

### How do I extract a table from a PDF into Excel?

In Excel for Microsoft 365 on Windows, choose Data > Get Data > From File > From PDF, then pick the table and load it. Similar tables on consecutive pages are joined by default. Adobe Acrobat's export to Excel can put each table on its own worksheet, and its text recognition setting reads scanned pages.

### How do I extract a table from an image or a scanned PDF?

Run OCR first, because an image has no text layer. For a single image, use Excel's Data from Picture. In code, the img2table library finds the table and uses an OCR engine to read it. Poor scans cause misreads, so send the cells the software is unsure about to a person.

### Which Python library is best for extracting tables from PDFs?

For PDFs with a text layer, Camelot suits ruled tables and scores each table it finds. Since version 2.0, it can also join tables that run across pages. pdfplumber gives detailed access to each character and line. For scans and images, img2table pairs table detection with an OCR engine you choose.

### What is a data extraction table?

In research, a data extraction table is the form a systematic review team fills in for each study it includes. It records the same details from every study, such as study design, participants, interventions and outcomes. It's a different thing from table extraction, which pulls tables out of documents.

**Sources**

1. [Prasad et al.: CascadeTabNet (arXiv, 2020)](https://arxiv.org/abs/2004.12629)
2. [Smock et al., Microsoft Research: PubTables-1M and Table Transformer (arXiv, 2021)](https://arxiv.org/abs/2110.00061)
3. [Zhong et al.: Image-based table recognition, PubTabNet and the TEDS metric (arXiv, 2019)](https://arxiv.org/abs/1911.10683)
4. [Camelot: GitHub repository and README](https://github.com/camelot-dev/camelot)
5. [Camelot documentation: API reference, TableList.stack_contiguous()](https://camelot-py.readthedocs.io/en/latest/api.html)
6. [tabula-py: GitHub repository](https://github.com/chezou/tabula-py)
7. [Tabula: GitHub repository (text-based PDFs only)](https://github.com/tabulapdf/tabula)
8. [Tabula: project site and latest release](https://tabula.technology/)
9. [pdfplumber: GitHub repository](https://github.com/jsvine/pdfplumber)
10. [PyMuPDF documentation: Page.find_tables()](https://pymupdf.readthedocs.io/en/latest/page.html)
11. [img2table: GitHub repository](https://github.com/xavctn/img2table)
12. [Microsoft Support: Insert data from picture (Excel)](https://support.microsoft.com/en-us/excel/insert-data-from-picture)
13. [Microsoft Support: Import data from data sources (Power Query), From PDF](https://support.microsoft.com/en-us/excel/import-data-from-data-sources-power-query)
14. [Microsoft Support: Power Query data sources in Excel versions](https://support.microsoft.com/en-us/excel/power-query-data-sources-in-excel-versions)
15. [Microsoft Learn: Pdf.Tables (MultiPageTables option)](https://learn.microsoft.com/en-us/powerquery-m/pdf-tables)
16. [Adobe Help: Convert PDFs to Excel and XML formats in Acrobat](https://helpx.adobe.com/acrobat/desktop/save-export-documents/convert-to-other-formats/pdf-to-excel.html)
17. [AWS: Amazon Textract features](https://aws.amazon.com/textract/features/)
18. [AWS: Amazon Textract developer guide, Tables](https://docs.aws.amazon.com/textract/latest/dg/how-it-works-tables.html)
19. [Microsoft Learn: Azure Document Intelligence layout model (tables)](https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/prebuilt/layout?view=doc-intel-4.0.0)
20. [Google Cloud: Document AI overview](https://docs.cloud.google.com/document-ai/docs/overview)
21. [Google Cloud: Document AI Form Parser](https://docs.cloud.google.com/document-ai/docs/form-parser)
22. [UNC Libraries: Systematic reviews, step 7: extract data](https://guides.lib.unc.edu/systematic-reviews/extract-data)

First published Nov 14, 2022. Last updated Oct 21, 2026.

**Written by** [Amit Timalsina](https://www.docsumo.com/blog-authors/amit-timalsina) · Python Developer, Docsumo

Amit is a self-taught Machine learning practitioner with expertise in application areas for logistics, eCommerce, health-tech, linguistics, and Document AI. Using Machine Learning, Natural Language processing, and MLOPs for day to day work, Amit helps Docsumo build End-to-End automated document processing solutions.

[LinkedIn](https://www.linkedin.com/in/amittimalsina/) · [All posts by Amit](https://www.docsumo.com/blog-authors/amit-timalsina)

- [Tesseract OCR: how it works and how to use it in Python](https://www.docsumo.com/blog/tesseract-ocr)
- [How to extract data from PDF files: 5 methods, from copy-paste to automated AI extraction](https://www.docsumo.com/blog/extract-data-from-pdf)
- [Named Entity Recognition: From Fundamentals to State of the Art](https://www.docsumo.com/blog/named-entity-recognition)

## Keep reading

- [How to extract data from PDF files: 5 methods, from copy-paste to automated AI extraction](https://www.docsumo.com/blog/extract-data-from-pdf): For operations and data teams that get invoices, statements and forms as PDFs every day. See the 5 ways to get the data out, which one fits your volume, and the checks that keep the numbers right.
- [OCR data extraction: how it works, methods and accuracy checks](https://www.docsumo.com/blog/ocr-data-extraction): For operations and finance teams replacing manual data entry. See what OCR reads, what extraction adds on top and how to get checked data out of scans, photos and PDFs.
- [What is image classification? Techniques, tools and uses in document AI](https://www.docsumo.com/blog/image-classification): For engineers and operations leads: how image classification works, which techniques and tools to use, a small working example, and how classifying document images speeds up data extraction.

[More on OCR & IDP](https://www.docsumo.com/blog#posts-idp)

## Next steps

- [Book a demo](https://www.docsumo.com/book-a-demo)
- [Get a free trial (1,000 pages)](https://www.docsumo.com/free-trial)
- [Contact sales or support](https://www.docsumo.com/contact)
- [agents.md](https://www.docsumo.com/agents.md): connect Docsumo to your AI agent with Docsumo MCP
- [llms.txt](https://www.docsumo.com/llms.txt) lists the key pages; add .md to any page's URL for its Markdown copy
