Docling OCRIndependent Docling guide
TableFormer Guide

Extracting PDF Tables to Excel: The Deep Learning Approach

Say goodbye to merged columns, broken rows, and hours of manual transcription. Learn how IBM's TableFormer deep learning model extracts clean, calculation-ready spreadsheets from any PDF.

100% Free & Open Source

Automate Table Extraction in 3 Lines of Python

Docling uses TableFormer to predict cell spans and coordinates geometrically. Export directly to pandas DataFrames and Excel spreadsheets.

View Python Recipe →

Borderless tables

Over 90% of tables in corporate earnings reports, SEC 10-K filings, and bank statements do not use solid gridlines. Instead, they use white space and typography to indicate column structure.

Traditional OCR tools look for black pixels separating columns. When lines are absent, they treat adjacent numbers as a single block of text. The result? A 10-column financial statement collapses into a chaotic single column in Excel.

How IBM TableFormer Solves It

TableFormer is an attention-based neural network trained specifically on millions of complex table structures. Rather than relying on ruling lines:

  • Cell Bounding Box Prediction: Identifies individual content tokens and predicts which tokens form a single cell.
  • Topological Matrix: Computes row-span and column-span relationships across multi-level headers.
  • Coordinate Normalization: Maps numbers to their precise column alignment regardless of whitespace variance.

Python Implementation (3 Steps)

1

Install Docling with Excel Support

Install Docling, pandas, and openpyxl: pip install docling pandas openpyxl

2

Convert PDF with DocumentConverter

Pass your PDF to DocumentConverter().convert("file.pdf"). TableFormer automatically detects and reconstructs all tables.

3

Export Tables to pandas & Excel

Iterate through result.document.tables, call table.export_to_dataframe(), and save directly to XLSX or TSV.

TableFormer provides table cells and spans. For a table that continues across pages, check the repeated headings and totals against the source before joining the grids.

Related Docling guides

Browse all Docling guides →