Rebuild the grid before interpreting its values

Recognize cell text, rebuild the grid, then validate relationships and arithmetic. Plain text alone is not a reliable table representation.

Use the method to produce an inspectable grid in which headers, rows, merged cells, blanks, units, signs, and totals can each be traced back to the image.

Put the procedure into practice with Table to Markdown. Continue with Numeric OCR Validation for Dates, Totals and Identifiers and Receipt, Invoice and Table OCR: A Field-First Workflow.

Table reconstruction controls

  • Capture the table title and units
  • Map all header levels
  • Distinguish blank from zero
  • Validate numeric formats by column
  • Compare every transformed cell with the image

Validate cells, headers, blanks, and relationships

Recover the header hierarchy

Identify title, column headers, row headers, units, and any spanning header before transcribing values. Flatten a multi-level header only after writing an explicit mapping to the final field names.

Represent empty states honestly

A blank cell, zero, dash, not applicable marker, and unreadable value are different. Choose explicit representations before export and never fill a blank from surrounding patterns unless the source supports that inference.

Protect numeric tokens

Review decimal and thousands separators, signs, percentages, currency symbols, footnote markers, and parentheses. Use column-level validation rules, then compare each flagged value with the source.

Handle merged and wrapped cells

Markdown cannot express row or column spans. Repeat a verified label, restructure the table, or use HTML when the merge is meaningful. Document the transformation rather than hiding it.

Rebuild one row with every relationship visible

Choose a row that includes a wrapped label, numeric values, a blank cell, and a unit. Identify the complete header path for every cell, including any merged group heading. Transcribe values only after the grid and header levels are explicit.

A blank is not automatically zero, and a repeated ditto mark is not the same as an empty cell. Verify signs, decimal separators, units, totals, and row boundaries against the image. When Markdown cannot express merged headers faithfully, use HTML, a spreadsheet, or a data structure that can preserve the relationship.

  • Define headers before values
  • Preserve blank and merged states
  • Recalculate totals without silently changing source values

Table state representation

Source stateSafe exportDo not assume
Empty cellBlank plus documented null ruleZero
Em dash used as no dataA documented missing markerNegative value
Merged category labelRepeated verified label or structured spanUnrelated blank rows
Illegible digitUncertainty marker and review flagMost likely neighboring value

Readable cells can still form a wrong table

OCR may recognize every token while shifting a value across a row, losing a merged header, or confusing blank, zero, and not applicable. Grid position remains part of the data.

What the sources support

The references explain table semantics and quality control. Validate the reconstructed grid against the image and recalculate relationships that can reveal a misplaced value.