Tools,

Scanned PDF to Excel, with numbers that add up

0 of 263

numbers Excel could add, from 3 free tools

Get the fix: fix_numbers.py

Docling read 99.5% of cells

Cells right, 10 tables, 591 cells
Way Rough scans Clean scans
Docling 99.5% 99.0%
Our Actor's code (paid) 99.3% 99.7%
camelot, ml flavor 80.5% 89.7%
OCRmyPDF, camelot stream 74.3% 85.4%
OCRmyPDF, camelot lattice 46.2% 53.5%
img2table, borderless 39.9% 40.1%
img2table, defaults 2.0% 2.2%

Ten made-up tables: bank statements, invoices, payroll and a trial balance. 6 have grid lines. Each became two simulated scans: rough, with blur and noise, and clean, like a good office scanner.

Every tool wrote numbers as text

A cell can hold 1,250.00 as a number, or as text that looks like one. SUM skips text.

On Docling's trial balance, =SUM(C2:C13) gave 0 in LibreOffice. After fix_numbers.py it gave 119,494.51, the true total.

Number cells Excel can add, of 263 (rough scans)
Way As written After the fix Column totals right
Docling 0 263 27 of 27
Our Actor's code Markdown 261 25 of 27
camelot, ml flavor 0 238 15 of 27
camelot stream 0 209 12 of 27
camelot lattice 0 137 7 of 27
img2table, borderless 0 101 9 of 27

Fix them with fix_numbers.py

fix_numbers.py

pip install openpyxl
python fix_numbers.py tables.xlsx

It writes tables-fixed.xlsx. It also reads a .csv file, or Markdown tables like our Actor's. It reads US style numbers only, like 1,234.56.

What it changes
Text in the cell Becomes
1,234.56 or $1,234.56 a number
(64.18) or 86.14- a negative number
12.5% 0.125, shown as a percent
03/14/2026 or 2026-03-14 a date (add --day-first for 14/03/2026)
00712, 02134 stays text, with the rest of its column

It prints each cell that stayed text in a column of numbers. On Docling's and our Actor's 40 files it printed two cells, and both were OCR misreads, like 1,204 ,330.50.

Docling: the best free way

pip install docling
import sys
from docling.document_converter import DocumentConverter
import pandas as pd

doc = DocumentConverter().convert(sys.argv[1]).document
if not doc.tables:
    sys.exit("no table found")
with pd.ExcelWriter(sys.argv[2]) as xw:
    for i, table in enumerate(doc.tables, 1):
        df = table.export_to_dataframe(doc=doc)
        df.to_excel(xw, sheet_name=f"Table {i}", index=False)
python scan2xlsx.py scan.pdf tables.xlsx
python fix_numbers.py tables.xlsx

camelot: OCRmyPDF first, or the ml flavor

ocrmypdf -l eng scan.pdf ocr.pdf
camelot stream -p all -o tables.xlsx ocr.pdf

The ml flavor reads the scan itself, in Python only:

pip install "camelot-py[ml,ocr]" "transformers<5"
import camelot

tables = camelot.read_pdf("scan.pdf", flavor="ml", pages="all")
tables.export("tables.xlsx", f="excel")

With transformers 5.24.1, every page failed with a ValueError, hence the pin. It took about 6 seconds a page.

img2table found no grid on our scans

With its defaults, img2table read almost nothing. With borderless_tables=True and implicit_rows=True it read the tables without lines at 98.2%, but still missed the grids.

It found both grids on the original digital page at 200 dpi, the dpi its PDF reader uses, but not on any scan. On other scans it did better: see table image to CSV.

No OCR install: our Actor

PDF OCR to Markdown, our Apify Actor, reads a scanned PDF by URL and returns its tables as Markdown. Save that as tables.md, then run python fix_numbers.py tables.md.

What I did not test

How I tested it
  • 10 made-up tables, 591 cells, with 263 numbers and 32 full dates.
  • 4 tables hold the cells of the scans on PDF to CSV.
  • The scans are drawn by code at 300 dpi. Rough: heavy blur, noise and JPEG. Clean: light blur and noise.
  • A cell is right when it shows the true text, number or date. Runs of spaces count as one.
  • Docling 2.143.1 with RapidOCR, and camelot-py 2.2.0.
  • OCRmyPDF 17.13.0, img2table 2.0.0 and Tesseract 5.5.4.
  • openpyxl read every file, and LibreOffice ran the SUM, on macOS.
  • Our Actor's code is build 0.1.141, run on our Mac.
  • Scripts and results stay in our private repo, in research/bench/scanned-pdf-to-excel-2026-11-25/.
Sources

Questions people ask

How do I convert a scanned PDF to Excel for free?

Run Docling with the 11-line script on this page, then fix_numbers.py. On our rough scans, Docling got 99.5% of the cells right, and the fix made every number one Excel can add.

Why does SUM give 0 on my converted table?

The numbers came in as text, and SUM skips text. Every free tool we tested did this. Run fix_numbers.py on the .xlsx file to turn them into real numbers.

Does it keep the leading zeros in codes and ZIP codes?

Yes. A code with a leading zero, like 02134, stays text, and so does the rest of its column. Docling and our Actor kept all 39 such codes on the rough scans.