Table OCR is not simply a matter of recognizing words. A useful extraction workflow must also understand rows, columns, cell boundaries, reading order, and exceptions such as merged cells or page breaks. This guide compares plain text, coordinates, CSV, HTML, and JSON output so developers can choose a practical format for extracting tables from scanned PDFs and images, then validate the result against real document layouts.
Overview
When an OCR API processes a scanned PDF or image, it may return several layers of information. Plain text provides the recognized characters. Coordinates add the position of each word or line. Structured formats attempt to represent the table itself, including rows, columns, cells, spans, and sometimes confidence information.
The best output depends on what happens after extraction. A person reading a report may only need searchable text. A spreadsheet workflow may need CSV. An application that maps invoice line items into a database usually needs JSON with explicit cell or row objects. A browser-based review tool may benefit from HTML because it preserves a visual table structure that can be rendered directly.
There is no universally correct table OCR format. The important distinction is whether the output preserves enough structure for the next step. A table can look correct to a human while still producing incorrect column assignments, duplicated headers, or values shifted into the wrong row. Treat the output format as part of the extraction design, not as a cosmetic choice made after OCR.
How to compare options
Compare table OCR workflows using the same representative documents and the same downstream checks. A small test set should include clean digital-looking scans, skewed pages, low-contrast images, and the difficult layouts your production system is expected to handle.
Start by defining the required result. If the goal is to extract text from a scanned PDF for search, coordinates may be sufficient. If the goal is PDF table to JSON conversion, the test must verify that each value is assigned to the correct row and column. If the result feeds accounting or inventory software, validation should include data types, totals, dates, currency symbols, and empty cells.
Use these comparison questions:
- Structure: Does the output identify tables, rows, columns, and individual cells?
- Position: Are bounding boxes or reading-order details available when the table detector is uncertain?
- Exceptions: Can it represent merged cells, multi-line values, blank cells, and repeated headers?
- Integration: Can your application consume the format without brittle string parsing?
- Review: Can low-confidence or ambiguous regions be routed to a human?
- Stability: Will your tests detect changes if the provider updates its layout model or output schema?
For a broader process, use a repeatable OCR accuracy testing benchmark and keep a regression set for important templates. Accuracy should be measured at the table level as well as the character level: correctly recognized text in the wrong column is still a failed extraction.
Feature-by-feature breakdown
| Output format | What it preserves | Best use | Typical limitation |
|---|---|---|---|
| Plain text | Recognized characters and basic reading order | Search, previews, accessibility, simple copying | Columns may collapse into an ambiguous sequence |
| Coordinates | Words, lines, or blocks with page positions | Custom layout logic, visual review, reconstruction | Your application must infer rows and columns |
| CSV | A rectangular row-and-column grid | Spreadsheets, simple imports, analyst review | Merged cells and nested structure are difficult to represent |
| HTML | Table markup, rows, columns, and visual presentation options | Browser review and human-readable exports | Rendering can hide structural errors; complex spans vary by implementation |
| JSON | Nested objects, cells, metadata, coordinates, and confidence fields when supported | APIs, databases, validation, and workflow automation | Schema design and provider-specific fields require maintenance |
Plain text: useful baseline, weak table model
Plain text is often the easiest output to store and search. It works well when the table is only supporting context, such as a report that users will read manually. It is less suitable when a value must be tied to a specific column. Spacing created by the original layout may not survive OCR, and multi-line cells can become indistinguishable from separate rows.
Coordinates: flexible but application-heavy
Coordinates provide the raw material for custom table reconstruction. An application can group words by their vertical position, estimate column boundaries, and preserve page-level evidence for review. This approach is useful for irregular documents, but it shifts responsibility to your code. Small changes in scan alignment, font size, or line spacing can affect grouping rules. Store the original coordinates when troubleshooting matters.
CSV: convenient for rectangular tables
CSV is a practical choice when every row follows the same column pattern. It is easy to inspect and import, but it has limited ways to describe a table’s original layout. A merged heading, a note beneath the table, or a cell containing line breaks may require escaping or a separate convention. Do not assume that a visually neat CSV proves that the source table was correctly detected.
HTML: strong for review, not automatically semantic
HTML can make extracted results easy to inspect in a browser. It supports table headers, row and column spans, and formatting that helps reviewers compare output with the source image. However, HTML generated from OCR may look plausible even when the underlying associations are wrong. Use explicit validation rather than relying on appearance alone.
JSON: the strongest foundation for automation
JSON is usually the most adaptable option for an OCR pipeline because it can represent nested data. A table object might contain rows, cells, text, coordinates, confidence values, and source-page references. Your internal schema should separate recognized text from derived interpretation. For example:
{
"table": {
"page": 1,
"headers": ["Item", "Quantity", "Amount"],
"rows": [
{"cells": ["Widget A", "2", "$18.00"]}
]
}
}
The exact fields depend on the OCR API or document extraction tool. Keep a normalization layer between the provider response and your business system so an output-schema change does not require rewriting every downstream integration.
Test worksheet for difficult table layouts
Before selecting a table OCR workflow, run each candidate against a worksheet like this. Record both the extracted output and the action your application takes when the result is uncertain.
| Test case | What to inspect | Pass condition |
|---|---|---|
| Merged cells | Header spans and parent-child relationships | The value is not duplicated into unrelated columns |
| Multi-line rows | Line breaks within descriptions or addresses | Continuation text remains in the correct cell and row |
| Page breaks | Rows split between pages and repeated headers | Rows are joined or flagged without creating duplicates |
| Handwritten entries | Legibility, confidence, and review routing | Uncertain values are flagged rather than silently accepted |
| Irregular columns | Variable widths, missing cells, and shifted alignment | Values remain associated with the intended headings |
Handwritten entries deserve a separate test path because recognition quality and table structure can fail independently. Define a confidence threshold or review rule rather than treating every returned value as equally reliable. The handwriting OCR testing guide covers sample selection and human review decisions in more detail.
Best fit by scenario
- Searchable document archive: Start with plain text or searchable PDF OCR. Add coordinates if users need highlighted search results or visual evidence.
- Spreadsheet export: Use CSV for consistent rectangular tables, but preserve the original page image and flag merged or irregular layouts for review.
- Invoice line-item processing: Prefer structured JSON or an equivalent cell-level format. Validate descriptions, quantities, tax values, totals, and currency fields before posting data.
- Analytics pipeline: Normalize JSON into a stable internal schema, retain source-page references, and log rows that do not match the expected column count.
- Human verification portal: HTML or JSON with coordinates can support side-by-side review. Show the source crop when a cell is low-confidence or structurally ambiguous.
- Changing report templates: Store layout versions and use regression tests. A layout model that works on one report design may not handle a later design with different headers or column spacing.
For workflows handling confidential documents, compare cloud, private, and on-premise processing requirements before implementation. The OCR data privacy checklist can help organize that evaluation. Pricing should also be assessed against pages, images, retries, asynchronous processing, and human review rather than a single per-page number; see this OCR API cost comparison framework.
When to revisit
Revisit your table OCR decision whenever the input documents, output requirements, or provider capabilities change. A workflow that is adequate for monthly reports may fail when a new template introduces merged headers, rotated pages, handwritten adjustments, or additional languages.
Set a practical review schedule around change events rather than relying only on a calendar. Re-test after a provider changes its layout model, output schema, SDK, or processing behavior. Re-test when your organization adds a document type, changes a form template, increases automation, or begins processing a new script or language. Also review the workflow after a production incident involving shifted columns, duplicated rows, missing pages, or unexpected API responses.
Your next action should be concrete: collect representative samples, label the expected rows and cells, run each output format through the same worksheet, and record failure modes. Choose the simplest format that preserves the structure your application truly needs. Keep the source image, normalized result, confidence or review status, and extraction version together so errors can be diagnosed later. Finally, add the approved samples to an automated regression suite and monitor production for accuracy drift, API failures, and document changes using this OCR production monitoring guide.