A merged cell spans two or more columns, such as a section heading stretched across a table, and extractors often split it into separate cells or drop it entirely. Comparing the extracted table with the printed one shows where merged cells were mishandled.
What you need
- Python with Camelot installed
- A PDF table with merged cells
- A terminal
Step 1: Extract the table with Camelot
Run Camelot on the table page with lattice mode if the table has ruling lines or stream mode if it does not, and export the result to CSV.
Step 2: Compare the CSV columns with the printed table
Open the CSV beside the PDF page and check each row. A merged heading that appears split across two cells, or a value that lands in the wrong column, marks a mishandled merge.
Step 3: Fix the extraction or correct the CSV by hand
Try the other Camelot mode on the same page, and if the merge still breaks, correct the affected cells in the CSV by hand and note the fix so the same table is handled the same way next time.
Worked example: synthetic merged-cell check on a timetable
The table below is a synthetic example. It shows the expected result of the extraction comparison; no extraction was run.
| Row | Printed table | Extracted CSV |
|---|---|---|
| Header | Monday to Friday, merged | Split into two cells |
| Row 1 | 09:00, Meeting | 09:00, Meeting |
| Row 2 | 10:00, Review | 10:00, Review |
| Total | 3 rows | 1 merged cell mishandled |
Expected result (UNTESTED). the data rows extract cleanly, but the merged header is split into two cells and must be corrected in the CSV. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Camelot’s lattice and stream modes handle merged cells differently, so test both before giving up.
- A merged cell that spans rows as well as columns is harder to extract correctly.
- Hand-correcting a CSV is fine for one table, but a repeated report needs a repeatable fix.
