Data Extraction

How to Test AI Table Extraction on a Messy PDF

Score PDF table extraction against a reference sheet that preserves merged headers, page boundaries, units, and subtotals.

A number under the wrong quarter is a table extraction error even if the digits are perfect. Score each number with its full row and column labels. Record unit and subtotal mistakes separately because they can change the totals downstream.

Create a short test file that matches the tables your app is supposed to handle. Include at least one merged header, a row carried onto the next page, repeated headers, and a note that changes a unit or scope. If real documents are sensitive, use a small invented table with the same layout. Keep its answer sheet outside the extraction prompt.

Build a reference a second reader can reproduce

Enter each expected row in a sheet with a stable identifier. Give grouped columns a complete name, such as “FY2026 / Q1 / Approved.” A match needs that full heading and the right number. Keep a page reference. Preserve blank cells, explicit zeroes, and unreadable cells as distinct states. Record whether an item is a detail, subtotal, or total. In a small invented sample, “12.5” in a column marked “USD thousands” represents USD 12,500. A service that preserves the digits but loses the unit fails the numeric check.

Google Cloud’s layout parser describes preserving relationships between tables and other layout elements, and Amazon Textract documents separate objects for cells, merged cells, headers, footers, and summaries. If your app exposes structure, retain its underlying output before turning it into a flat CSV. That makes it easier to see whether an error began during recognition or when the rows were flattened. Document AI layout parser · Amazon Textract tables

Score cells, structure, and totals separately

Check What to mark
Cell match Correct full row key, complete column name, and normalized value.
Blank and zero A blank stays blank and an explicit 0 stays 0.
Page boundary Continuation rows attach to the right section and repeated headers stay out of the data.
Unit Values retain the declared currency and scale.
Subtotal Summary row is identified and stays out of the sum of detail rows.

Let the number of expected cells be the denominator. If 33 of 36 match, report 91.7 percent and list the three misses by reason. Log surplus rows as a separate count of extras. Keep the denominator fixed to the reference so a duplicated header won’t change the number of expected cells.

Choose a continuation row you can trace

Build a two-page test invoice or sales report with a row that starts near the end of the first page. Give its description a second line that continues on the next page. Include a repeated column header above that line. On the answer sheet, mark exactly which pieces belong to the line item and which row supplies its amount. A tool can extract all text on both pages and still turn the repeated heading into a record. Check the rows in their expected order.

Add two grouped columns with similar labels. “Projected / Q2” and “Actual / Q2” both contain Q2 in their headings, so a bare quarter label cannot select a number reliably. Use the full header path when writing the reference. If the tool provides positions, record enough of the location to point a reviewer at the correct column and page. Distinguish a row that was missed from a number that was moved into a neighboring row.

Suppose a labelling error moves the actual amount to the projected column. The numeric digits might still appear in the CSV, and the total number of cells can be right. Count the reference cell as a miss and log the unexpected value at its extracted key. For a blank that became a zero, mark the blank-state failure explicitly. If you normalize decimal separators, save the original value alongside the normalized one so a reviewer can see which transformation applied.

Look at structure before converting to a spreadsheet

Save the extraction result before it is flattened if your tool lets you. Some software exposes a table object, rows and a location or type for each cell. The output may represent a spanning column title separately from the cells below it. Inspect the extracted result and decide whether the error appears there or first appears when you convert it to CSV.

If the extractor detects two independent tables on consecutive pages, preserve both identifiers while diagnosing the joining rule. A join based only on columns being the same width may mistakenly combine reports from different periods. Use a clear part of the source, such as the table title and known continuation marker. A test with an unrelated second table can reveal this problem. Check both the intended merge and the case that should remain separate.

Review summary lines before adding formulas. Consider a report where three detail rows sum to 50 and the subtotal row repeats 50. If your import adds all four amounts, the spreadsheet shows 100 even though each individual cell is accurate. Mark the subtotal as a different role on the answer sheet. Compare the recomputed detail sum with the subtotal and investigate differences before feeding it to another report.

Choose one condition that stops an import

A match rate is useful for comparing two software releases against the same sample. A missing currency or reporting period can matter more than several missed labels. Write an explicit review rule for the fields that affect a decision. If the expected unit is not present or the totals disagree for the wrong reason, put the affected rows aside and preserve their page and table references.

After correcting an output row, recheck both its value and key. The revised file should preserve identifiers and blanks when it reaches the workbook. Use the structured output import guide to run those checks in a disposable sheet. Keep an example of each high-impact error that the current tool has made. When a table format changes, add a new sample and keep the older one so you can tell whether the change fixed a new layout at the cost of existing coverage.

Give the reviewer one sample where the same account name appears in successive sections. The page and section title should distinguish the two amounts. A stable detail key that ignores the section can merge them by mistake before any total is calculated.

Sources