Skip to main content
POST
/
v1
/
splits
/
reconstruct
from retab import Retab

client = Retab()

result = client.splits.create_reconstruct(
    document={
        "id": "doc_01G34H8J2K",
        "filename": "orders_workbook.xlsx",
        "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    },
    subdocuments=[
        {
            "name": "orders",
            "regions": [
                {
                    "sheet_name": "Orders",
                    "sheet_index": 0,
                    "row_start": 2,
                    "row_end": 148,
                    "header_rows": [1],
                }
            ],
            "partition_key": "order_number",
        }
    ],
)

for table in result.tables:
    print(f"{table.label}: {len(table.rows)} rows")
{
  "tables": [
    {
      "label": "orders",
      "header": ["order_number", "sku", "quantity", "unit_price"],
      "rows": [
        { "cells": ["SO-1001", "WIDGET-A", "12", "4.50"] },
        { "cells": ["SO-1001", "WIDGET-B", "3", "17.00"] }
      ],
      "csv": "order_number,sku,quantity,unit_price\nSO-1001,WIDGET-A,12,4.50\nSO-1001,WIDGET-B,3,17.00\n"
    }
  ]
}
Reconstruct each named subdocument of a stored spreadsheet into an enriched, partition-ready table: one flat complete header, the key carried on every row, section banners promoted to a column, and wide size-matrices melted. Returns the enriched tables (header + rows + clean CSV) for hand-off to extraction.
from retab import Retab

client = Retab()

result = client.splits.create_reconstruct(
    document={
        "id": "doc_01G34H8J2K",
        "filename": "orders_workbook.xlsx",
        "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    },
    subdocuments=[
        {
            "name": "orders",
            "regions": [
                {
                    "sheet_name": "Orders",
                    "sheet_index": 0,
                    "row_start": 2,
                    "row_end": 148,
                    "header_rows": [1],
                }
            ],
            "partition_key": "order_number",
        }
    ],
)

for table in result.tables:
    print(f"{table.label}: {len(table.rows)} rows")
{
  "tables": [
    {
      "label": "orders",
      "header": ["order_number", "sku", "quantity", "unit_price"],
      "rows": [
        { "cells": ["SO-1001", "WIDGET-A", "12", "4.50"] },
        { "cells": ["SO-1001", "WIDGET-B", "3", "17.00"] }
      ],
      "csv": "order_number,sku,quantity,unit_price\nSO-1001,WIDGET-A,12,4.50\nSO-1001,WIDGET-B,3,17.00\n"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
document
ReconstructDocumentRef · object
required
subdocuments
ReconstructSubdocument · object[]
required

Response

Successful Response

tables
ReconstructEnrichedTable · object[]
required