Skip to content

Tables

Tables are returned whenever tables=true, which is the default. They appear in two places: as pipe tables inside markdown, and as structured objects in tables[].

{
"page": 3,
"bbox": [0.071, 0.182, 0.929, 0.611],
"n_rows": 4,
"n_cols": 4,
"rows": [
["Item", "Qty", "Unit price", "Amount"],
["Design work", "12 h", "120.00", "1,440.00"],
["Hosting", "1", "49.00", "49.00"],
["Total", "", "", "1,489.00"]
],
"csv": "Item,Qty,Unit price,Amount\nDesign work,12 h,120.00,\"1,440.00\"\nHosting,1,49.00,49.00\nTotal,,,\"1,489.00\"",
"markdown": "| Item | Qty | Unit price | Amount |\n|---|---|---|---|\n| Design work | 12 h | 120.00 | 1,440.00 |\n| Hosting | 1 | 49.00 | 49.00 |\n| Total | | | 1,489.00 |"
}
Field Meaning
page Page the table starts on
bbox [x0, y0, x1, y1] normalised to 0–1, or null when the source has no geometry (DOCX, XLSX, email)
n_rows, n_cols Grid size after merging
rows The grid as strings, row-major. Spanned cells are filled into the top-left position and the covered cells are empty
csv RFC 4180-style CSV: fields containing commas, quotes or newlines are quoted, quotes doubled
markdown The same grid as a GitHub-flavoured pipe table

The first row is treated as the header when rendering Markdown. Where a block of type table appears in blocks[], its meta.table_index points at the matching entry in tables[] for that page.

Source Detection
PDF text layer Ruled tables found from the page’s drawn lines; the cells are the text inside each box
Scanned pages and images The OCR model emits tables as part of layout analysis
DOCX Word tables, including horizontally merged cells
XLSX / CSV Each sheet is one table
PPTX Table shapes
HTML email bodies <table> elements

Long tables usually break across pages, often with the header repeated on each page. During the merge step Deskew joins the last table on a page with the first table on the next page when all of the following hold:

  • both have the same number of columns;
  • the first table is the last content block on its page and the second is the first content block on its page (running headers and footers are ignored when checking this);
  • either the second table’s first row repeats the first table’s header, or its first row does not look like a header at all (most cells contain digits).

The joined table keeps the starting page number, a repeated header row is dropped, and the job’s warnings[] gains an entry like 2 table(s) joined across pages. The dashboard’s job detail shows the same count.

Tables with a different column count are never merged, so a two-column summary table on the following page stays separate.

Each table already carries a csv string. To write every table in a document to files:

for i, t in enumerate(result["tables"]):
with open(f"table-{i}-page-{t['page']}.csv", "w", newline="") as f:
f.write(t["csv"])

For a spreadsheet, tables[] has one entry per sheet in sheet order, so result["tables"][0]["rows"] is the first sheet.

tables=false omits tables[] from the result and skips table detection on text-layer pages. Table text still appears in the Markdown as ordinary lines. Use it for prose documents where ruled boxes (forms, letterheads) would otherwise be picked up as tables.