New Tool Radar

AI PDF

How to Check a Table Split Across Pages Keeps Its Header Row on Each Page

Extract a multi-page table and check that the header row appears on every continuation page.

Schematic with three steps: Extract the table from each page; Check the first row of each continuation; Join the tables with the headers removed.

A long table that runs across several pages is usually extracted as one table per page. If the header row is missing from the continuation pages, the rows from those pages have no labels, and a reader or a spreadsheet cannot tell which column is which.

What you need

  • Python with Camelot installed
  • A PDF with a table that runs across two or more pages
  • The table as printed, with its header row noted

Step 1: Extract the table from each page

Run Camelot on each page of the table and export the tables to CSV files, one per page.

Step 2: Check the first row of each continuation

Open the CSV for each continuation page and check that its first row is the header row, with the same column names as the first page.

Step 3: Join the tables with the headers removed

When you join the pages into one table, keep the header from the first page and drop the repeated headers from the later pages, so the final table has one header and no duplicate rows.

Worked example: synthetic header check on a table across 2 pages

The table below is a synthetic example. It shows the expected result of checking repeated headers; no extraction was run.

Page First row in CSV Verdict
Page 1 Product, Qty, Total Header – correct
Page 2 Product, Qty, Total Header repeated – correct
Page 2, row 2 Widget C, 6, 240 Data row – correct
Page 2, row 3 Widget D, 9, 360 Data row – correct

Expected result (UNTESTED). the header row repeats on page 2, so the continuation rows are labelled correctly. Join the pages by keeping the first header and dropping the repeated one. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Camelot extracts one table per page, so joining the pages is a separate step you must do yourself.
  • A header that is split across two lines on a continuation page may extract as two rows.
  • Some PDFs repeat the header only as an image, in which case the extracted CSV has no header on that page.

Sources

See all