Camelot reads tables in two modes: lattice mode uses the drawn lines of a ruled table, and stream mode uses the gaps between words. Both modes need text in the PDF, so a scan must be OCRed first. This guide extracts one ruled table with lattice mode.
Prerequisites
Python, camelot-py installed, Java for the older versions, OCRmyPDF for the OCR step, and a scanned PDF with a ruled table. Work on a copy.
Steps
1. OCR the scanned PDF first
Run OCRmyPDF on the scanned PDF to add a text layer. Expected result: the table text becomes selectable in the output PDF.
2. Read the table with Camelot lattice mode
Run camelot.read_pdf with flavor lattice on the OCRed PDF. Expected result: one table is returned with a parsing report.
3. Check the table against the printed page
Compare the returned table with the printed page cell by cell. Expected result: the three rows match the printed page.
4. Check the parsing report accuracy
Read the accuracy figure in the parsing report. Expected result: the report shows an accuracy above 90 for the table.
Practice check: fictional catering order, three-row ruled table
The table below is fictional practice material. It lists the three rows Camelot must return.
| Item | Amount |
|---|---|
| Sandwiches, 20 units | 45.00 |
| Drinks, 30 units | 22.50 |
| Cakes, 4 units | 18.00 |
| Total | 85.50 |
Expected result. Camelot returns the three rows, which add to 85.50, and the parsing report shows an accuracy above 90.
Limits
- Lattice mode needs drawn lines; a table without borders needs stream mode instead, and a scan that OCR read badly gives Camelot bad text either way.
- UNTESTED – no OCR tool or AI tool was run; all results above are expected results. The practice file is fictional.
Sources
- Tabula vs Camelot vs pdfplumber in 2026 – Tabula suits stream tables, Camelot lattice tables, pdfplumber complex layouts; none of them reads scans without OCR first. Checked 2026-11-29.
- Table extraction from PDFs: pdfplumber, Camelot, Tabula, and scans – Check the PDF has selectable text first with pdftotext -layout; scanned PDFs need OCR before these tools. Checked 2026-11-29.
