# Python PDF table extraction libraries

Python PDF table extraction libraries find tables on PDF pages and return their rows and cells as data. A text-based extractor reads the characters and ruling lines stored in a digital PDF rather than recognizing text from page images. These libraries let data pipelines and AI agents load tables from reports, invoices, and filings into DataFrames.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [PyMuPDF](#pymupdf-library) | 171.3M | 11.2K | Nov 2026 | AGPL-3.0 or commercial |
| [pdfplumber](#pdfplumber) | 69.7M | 10.9K | Jun 2026 | MIT |
| [Docling](#docling) | 4.3M | 70.8K | Nov 2026 | MIT |
| [Unstructured](#unstructured) | 2.6M | 15.8K | Nov 2026 | Apache-2.0 |
| [Camelot](#camelot) | 2.4M | 3.9K | Jun 2026 | MIT |
| [tabula-py](#tabula-py) | 1.8M | 2.3K | Nov 2026 | MIT |
| [pdf2docx](#pdftwodocx) | 1.8M | 3.5K | May 2026 | MIT |
| [PaddleOCR](#paddleocr) | 1.4M | 92.9K | Jun 2026 | Apache-2.0 |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[PyMuPDF](#pymupdf-library) has the most monthly downloads in this comparison, at 171.3M, a count that covers all its PDF work.

## Capabilities

| Library | Table cells as dataframe | Java backend |
| --- | --- | --- |
| [PyMuPDF](#pymupdf-library) | Yes | No |
| [pdfplumber](#pdfplumber) | No | No |
| [Docling](#docling) | Yes | No |
| [Unstructured](#unstructured) | No | No |
| [Camelot](#camelot) | Yes | No |
| [tabula-py](#tabula-py) | Yes | Yes |
| [pdf2docx](#pdftwodocx) | No | No |
| [PaddleOCR](#paddleocr) | Undocumented | No |

## Libraries

### PyMuPDF

[GitHub](https://github.com/pymupdf/PyMuPDF) · [PyPI](https://pypi.org/project/pymupdf) · [Docs](https://pymupdf.readthedocs.io/en/latest/page.html#Page.find_tables)

Extracts, analyzes, converts, and edits PDF and other documents.

- Downloads / mo: 171.3M
- Stars: 11.2K
- Last release: 2.1
- License: AGPL-3.0 or commercial
- Capabilities: [From the PyMuPDF docs](https://pymupdf.readthedocs.io/en/latest/page.html#Page.find_tables)

```sh
python3.11 -m pip install pymupdf==2.1
```

**Filimoa/open-parse** (3.1K stars)

[Filimoa/open-parse](https://github.com/Filimoa/open-parse) 

```python
def _ingest_with_pymupdf(
    doc: Pdf,
    parsing_args: PyMuPDFArgs,
    verbose: bool = False,
) -> List[TableElement]:
    pdoc = doc.to_pymupdf_doc()
    tables = []
    for page_num, page in enumerate(pdoc):
        tabs = page.find_tables()
        for i, tab in enumerate(tabs.tables):
            headers = tab.header.names
            for j, header in enumerate(headers):
                if header is None:
                    headers[j] = ""
                else:
                    headers[j] = header.strip()
            lines = tab.extract()

            if parsing_args.table_output_format == "str":
                text = pymupdf.output_to_markdown(headers, lines)
            elif parsing_args.table_output_format == "markdown":
                text = pymupdf.output_to_markdown(headers, lines)
            elif parsing_args.table_output_format == "html":
                text = pymupdf.output_to_html(headers, lines)

            if verbose:
                print(f"Page {page_num} - Table {i + 1}:\n{text}\n")

            # Flip y-coordinates to match the top-left origin system
            bbox = pymupdf.combine_header_and_table_bboxes(tab.bbox, tab.header.bbox)
            fy0 = page.rect.height - bbox[3]
            fy1 = page.rect.height - bbox[1]

            table = TableElement(
                bbox=Bbox(
                    page=page_num,
                    x0=bbox[0],
                    y0=fy0,
                    x1=bbox[2],
                    y1=fy1,
                    page_width=page.rect.width,
                    page_height=page.rect.height,
                ),
                text=text,
            )
            tables.append(table)
    return tables
```

[src/openparse/tables/parse.py](https://github.com/Filimoa/open-parse/blob/6c2da9b5da5606c8297546be572984464f093964/src/openparse/tables/parse.py) · [More projects using PyMuPDF →](https://dashboard.exa.ai/playground/search?q=pymupdf%20GitHub%20projects)

**Quickstart**

```python
import sys
import pymupdf

with pymupdf.open(sys.argv[1]) as document:
    print([table.extract() for table in document[0].find_tables().tables])

```

From [page.html](https://pymupdf.readthedocs.io/en/latest/page.html#Page.find_tables)

### pdfplumber

[GitHub](https://github.com/jsvine/pdfplumber) · [PyPI](https://pypi.org/project/pdfplumber)

Extracts table rows while exposing cells, edges, and page geometry.

- Downloads / mo: 69.7M
- Stars: 10.9K
- Last release: 0.11.10
- License: MIT
- Capabilities: [From the pdfplumber docs](https://github.com/jsvine/pdfplumber)

**Strengths**

- **Exposes table cells and bounds.** Inspect cells, rows, columns, and bounding boxes before extracting values.
- **Crops before table extraction.** Crop the page to focus extraction on the relevant table area.

**Watch out for**

- **Scanned PDFs.** Handles machine-generated PDFs more reliably than scanned PDFs.

```sh
python3.11 -m pip install pdfplumber==0.11.10
```

**microsoft/cat-agent-skills** (109 stars)

[microsoft/cat-agent-skills](https://github.com/microsoft/cat-agent-skills) 

```python
def main(argv=None):
    parser = argparse.ArgumentParser(description="Extract PDF tables to xlsx/csv.")
    parser.add_argument("pdf", help="path to the source PDF")
    parser.add_argument("--out-dir", default="out", help="directory for output files")
    parser.add_argument("--pages", default="", help="page selector, e.g. 2-5 or 1,3")
    parser.add_argument("--contains", default="", help="keep only tables containing this text (case-insensitive)")
    parser.add_argument("--prefix", default="", help="filename prefix for the output")
    parser.add_argument(
        "--format",
        choices=["xlsx", "csv", "both"],
        default="xlsx",
        help="output format (default: xlsx, one formatted tab per table)",
    )
    args = parser.parse_args(argv)

    try:
        import pdfplumber  # noqa: WPS433 (imported lazily so the message is clear)
    except ImportError:
        sys.exit(
            "pdfplumber is required. Install it with `pip install pdfplumber`, "
            "or extract the tables manually following the skill's cleaning rules."
        )

    want_xlsx = args.format in ("xlsx", "both")
    workbook = None
    if want_xlsx:
        try:
            from openpyxl import Workbook
        except ImportError:
            if args.format == "xlsx":
                sys.stderr.write(
                    "openpyxl not available; falling back to CSV output. "
                    "Install it with `pip install openpyxl` for formatted .xlsx.\n"
                )
                args.format = "csv"
                want_xlsx = False
            else:
                sys.stderr.write(
                    "openpyxl not available; producing CSV only.\n"
                )
                want_xlsx = False
        else:
            workbook = Workbook()
            workbook.remove(workbook.active)

    want_csv = args.format in ("csv", "both")

    if not os.path.isfile(args.pdf):
        sys.exit(f"file not found: {args.pdf}")

    os.makedirs(args.out_dir, exist_ok=True)
    base = args.prefix or slugify(os.path.splitext(os.path.basename(args.pdf))[0], "document")
    needle = args.contains.lower()

    tables_out, csv_files, used_titles = [], [], set()
    with pdfplumber.open(args.pdf) as pdf:
        page_indexes = parse_pages(args.pages, len(pdf.pages))
        for page_index in page_indexes:
            page = pdf.pages[page_index]
            page_number = page_index + 1
            tables = page.extract_tables() or []
            for table_number, raw in enumerate(tables, start=1):
                grid = clean_table(raw)
                if not grid:
                    continue
                if needle and needle not in "\n".join(
                    " ".join(row) for row in grid
                ).lower():
                    continue

                entry = {"page": page_number, "rows": len(grid), "columns": len(grid[0])}

                if want_csv:
                    csv_name = f"{base}-p{page_number}-t{table_number}.csv"
                    csv_path = os.path.join(args.out_dir, csv_name)
                    write_csv(csv_path, grid)
                    csv_files.append(csv_path)
                    entry["csv"] = csv_path

                if want_xlsx:
                    title = sheet_title(base, page_number, table_number, used_titles)
                    worksheet = workbook.create_sheet(title=title)
                    for row in grid:
                        worksheet.append(row)
                        # Force every cell to text so values are preserved
                        # verbatim — otherwise a cell like "=high" or "-5" would
                        # be interpreted by openpyxl/Excel as a formula and lose
                        # its original value.
                        for cell in worksheet[worksheet.max_row]:
                            cell.data_type = "s"
                    style_sheet(worksheet, grid)
                    entry["sheet"] = title

                tables_out.append(entry)

    xlsx_path = None
    if want_xlsx and tables_out:
        xlsx_path = os.path.join(args.out_dir, f"{base}.xlsx")
        workbook.save(xlsx_path)

    summary = {
        "source": args.pdf,
        "count": len(tables_out),
        "xlsx": xlsx_path,
        "csv_files": csv_files,
        "tables": tables_out,
    }
    json.dump(summary, sys.stdout, indent=2)
    sys.stdout.write("\n")
    if not tables_out:
        sys.stderr.write(
            "No tables matched. Try a different --pages range, drop --contains, "
            "or verify the PDF has extractable (non-image) tables.\n"
        )
        return 1
    return 0
```

[submissions/pdf-table-data-conversion/scripts/extract_tables.py](https://github.com/microsoft/cat-agent-skills/blob/189409b5be6caf7c83bfaac1857044e72b053dbe/submissions/pdf-table-data-conversion/scripts/extract_tables.py) · [More projects using pdfplumber →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20pdfplumber%20to%20extract%20PDF%20table%20rows%20and%20coordinates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import sys
import pdfplumber

with pdfplumber.open(sys.argv[1]) as document:
    print(document.pages[0].extract_tables())

```

From [extract-table-ca-warn-report.ipynb](https://github.com/jsvine/pdfplumber/blob/v0.11.10/pdfplumber/page.py)

### Docling

[GitHub](https://github.com/docling-project/docling) · [PyPI](https://pypi.org/project/docling) · [Docs](https://api.github.com/repos/docling-project/docling/contents/docling/document_converter.py?ref=v2.150.1)

Parses PDF, DOCX, HTML, and other formats into one document representation.

- Downloads / mo: 4.3M
- Stars: 70.8K
- Last release: 2.150.1
- License: MIT
- Capabilities: [From the Docling docs](https://api.github.com/repos/docling-project/docling/contents/docling/document_converter.py?ref=v2.150.1)

```sh
python3.11 -m pip install docling==2.150.1 pandas tabulate
```

**Quickstart**

```python
import sys
from docling.document_converter import DocumentConverter

result = DocumentConverter().convert(sys.argv[1])
print([table.export_to_dataframe(doc=result.document) for table in result.document.tables])

```

From [document_converter.py](https://github.com/docling-project/docling/blob/v2.150.1/docling/document_converter.py) · [Find projects using Docling →](https://dashboard.exa.ai/playground/search?q=docling%20GitHub%20projects)

### Unstructured

[GitHub](https://github.com/Unstructured-IO/unstructured) · [PyPI](https://pypi.org/project/unstructured) · [Docs](https://api.github.com/repos/Unstructured-IO/unstructured/contents/unstructured/partition/pdf.py?ref=0.27.37)

Prepares raw documents for machine learning tasks.

- Downloads / mo: 2.6M
- Stars: 15.8K
- Last release: 0.27.37
- License: Apache-2.0
- Capabilities: [From the Unstructured docs](https://api.github.com/repos/Unstructured-IO/unstructured/contents/unstructured/partition/pdf.py?ref=0.27.37)

```sh
python3.11 -m pip install "unstructured[pdf]==0.27.37"
```

**Quickstart**

```python
import sys
from unstructured.partition.pdf import partition_pdf

elements = partition_pdf(filename=sys.argv[1], strategy="hi_res", infer_table_structure=True)
print([element.metadata.text_as_html for element in elements if element.category == "Table"])

```

From [pdf.py](https://github.com/Unstructured-IO/unstructured/blob/0.27.37/unstructured/partition/pdf.py) · [Find projects using Unstructured →](https://dashboard.exa.ai/playground/search?q=unstructured%20GitHub%20projects)

### Camelot

[GitHub](https://github.com/camelot-dev/camelot) · [PyPI](https://pypi.org/project/camelot-py) · [Docs](https://github.com/camelot-dev/camelot/blob/master/README.md)

Extracts PDF tables using selectable rule-based or optional neural parsers.

- Downloads / mo: 2.4M
- Stars: 3.9K
- Last release: 2.0.0
- License: MIT
- Capabilities: [From the Camelot docs](https://github.com/camelot-dev/camelot/blob/master/README.md)

**Strengths**

- **Chooses parsers for different layouts.** Use lattice for ruled tables or stream for whitespace-separated tables.
- **Exports tables directly.** Save extracted tables as CSV, JSON, or HTML.

**Watch out for**

- **Scanned pages need OCR extras.** Install the neural and OCR extras, then select the ml parser.
- **Reads the first page initially.** Set pages explicitly to extract tables beyond the first page.

```sh
python3.11 -m pip install camelot-py==2.0.0
```

**run-llama/llama_index** (52.9K stars)

[run-llama/llama_index](https://github.com/run-llama/llama_index) 

```python
def load_data(
    self, file: Path, pages: str = "1", extra_info: Optional[Dict] = None
) -> List[Document]:
    """
    Load data and extract table from PDF file.

    Args:
        file (Path): Path for the PDF file.
        pages (str): Pages to read tables from.
        extra_info (Optional[Dict]): Extra information.

    Returns:
        List[Document]: List of documents.

    """
    import camelot

    results = []
    tables = camelot.read_pdf(filepath=str(file), pages=pages)

    for table in tables:
        document = self._dataframe_to_document(df=table.df, extra_info=extra_info)
        results.append(document)

    return results
```

[llama-index-integrations/readers/llama-index-readers-pdf-table/llama_index/readers/pdf_table/base.py](https://github.com/run-llama/llama_index/blob/99d7433f6f71888951379ccca9294e272442c832/llama-index-integrations/readers/llama-index-readers-pdf-table/llama_index/readers/pdf_table/base.py) · [More projects using Camelot →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20camelot-py%20to%20extract%20PDF%20table%20rows%20and%20coordinates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import sys
import camelot

tables = camelot.read_pdf(sys.argv[1])
print([table.df for table in tables])

```

From [README.md](https://github.com/camelot-dev/camelot/blob/v2.0.0/camelot/io.py)

### tabula-py

[GitHub](https://github.com/chezou/tabula-py) · [PyPI](https://pypi.org/project/tabula-py) · [Docs](https://tabula-py.readthedocs.io/en/latest/tabula.html)

Wraps the Java table-extraction engine with Python data-frame and file conversion APIs.

- Downloads / mo: 1.8M
- Stars: 2.3K
- Last release: 2.11.0
- License: MIT
- Capabilities: [From the tabula-py docs](https://tabula-py.readthedocs.io/en/latest/tabula.html)

**Strengths**

- **Handles ruled and unruled tables.** Choose lattice for cell borders or stream for tables without borders.
- **Targets a selected page area.** Pass area to limit extraction to the chosen page rectangle.

**Watch out for**

- **Requires a working Java installation.** Install Java and make its command available to the Python process.
- **Reads the first page initially.** Use pages="all" when the whole document should be searched.

```sh
python3.11 -m pip install tabula-py==2.11.0
```

**Quickstart**

```python
import sys
import tabula

print(tabula.read_pdf(sys.argv[1], pages="all"))

```

From [README.md](https://github.com/chezou/tabula-py/blob/v2.11.0/tabula/io.py) · [Find projects using tabula-py →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20tabula-py%20to%20extract%20PDF%20table%20rows%20and%20coordinates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### pdf2docx

[GitHub](https://github.com/ArtifexSoftware/pdf2docx) · [PyPI](https://pypi.org/project/pdf2docx) · [Docs](https://pdf2docx.readthedocs.io/en/latest/quickstart.table.html)

Converts PDF to DOCX.

- Downloads / mo: 1.8M
- Stars: 3.5K
- Last release: 0.5.13
- License: MIT
- Capabilities: [From the pdf2docx docs](https://pdf2docx.readthedocs.io/en/latest/quickstart.table.html)

```sh
python3.11 -m pip install pdf2docx==0.5.13
```

**Quickstart**

```python
import sys
from pdf2docx import Converter

converter = Converter(sys.argv[1])
try:
    print(converter.extract_tables(start=0, end=1))
finally:
    converter.close()

```

From [quickstart.table.rst](https://github.com/ArtifexSoftware/pdf2docx/blob/v0.5.13/pdf2docx/converter.py) · [Find projects using pdf2docx →](https://dashboard.exa.ai/playground/search?q=pdf2docx%20GitHub%20projects)

### PaddleOCR

[GitHub](https://github.com/PaddlePaddle/PaddleOCR) · [PyPI](https://pypi.org/project/paddleocr) · [Docs](https://www.paddleocr.ai/latest/en/version3.x/pipeline_usage/PP-StructureV3.html)

Runs multilingual OCR and document parsing on PaddlePaddle.

- Downloads / mo: 1.4M
- Stars: 92.9K
- Last release: 3.7.0
- License: Apache-2.0
- Capabilities: [From the PaddleOCR docs](https://www.paddleocr.ai/latest/en/version3.x/pipeline_usage/PP-StructureV3.html)

```sh
python3.11 -m pip install "paddleocr[doc-parser]==3.7.0" paddlepaddle==3.3.0
```

**Quickstart**

```python
import sys
from paddleocr import PPStructureV3

pipeline = PPStructureV3(use_table_recognition=True)
for result in pipeline.predict(input=sys.argv[1]):
    result.save_to_html(save_path="table-output")

```

From [README.md](https://github.com/PaddlePaddle/PaddleOCR/blob/v3.7.0/paddleocr/_pipelines/pp_structurev3.py) · [Find projects using PaddleOCR →](https://dashboard.exa.ai/playground/search?q=paddleocr%20GitHub%20projects)

## FAQ

### Which Python PDF table extraction library should I use?

[pdfplumber](#pdfplumber) suits digital PDFs where table settings need tuning against characters and lines. [Camelot](#camelot) suits table-only extraction straight into pandas DataFrames. [Docling](#docling) suits whole-document conversion with optional OCR for scanned pages.

### What is Docling?

[Docling](#docling) converts PDF, DOCX, HTML, and other formats into one document model that includes tables. It runs locally and can use optional OCR backends.

### What is pdfplumber?

[pdfplumber](#pdfplumber) exposes every character, line, and rectangle on a PDF page and finds tables from them. Its extract_tables method returns nested lists of cells rather than DataFrames.

### How do I extract tables from a PDF in Python?

[Camelot](#camelot) and [tabula-py](#tabula-py) read PDF tables directly into pandas DataFrames. tabula-py wraps tabula-java and requires a Java runtime.

### What is Camelot?

[Camelot](#camelot) is a dedicated PDF table parser that returns pandas DataFrames, with lattice, stream, network, and hybrid parsing modes.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python PDF table extraction libraries Camelot tabula-py pdfplumber PyMuPDF code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
