Prerequisites
- A completed parse job. See Parse your first document if you need one.
- The structured result, fetched with
get_structured_result, which is where the cell grid is exposed.
Find the tables
The structured result groups elements by page. Walk the pages and filter their elements bylabel to pull out the tables. Each table element holds a table object with its cell grid, its num_rows and num_cols counts, the page it sits on, and a confidence score.
Read cells into a grid
Each cell reports itsrow, its col, and its text. Because the grid dimensions are known from num_rows and num_cols, you can allocate a 2D array and place every cell at its coordinate. This gives you the table as nested lists, ready to write to a CSV, load into a dataframe, or compare against expected values.
Handle merged and spanning cells
Real tables sometimes merge cells, most often in headers. A cell that spans more than one column or row reportscol_span or row_span greater than 1. The cell’s text belongs at its starting row and col; the positions it covers hold no separate cell of their own. To keep the grid rectangular, write the text across every position the cell spans.
Each cell carries
is_header, so you can separate header cells from data cells directly rather than assuming the first row. Group the header cells to build column names, and treat the rest as the body.Check confidence before trusting a table
A table element carries aconfidence score. Complex or scanned tables score lower than clean digital ones. When you extract tables at scale, gate on this score and route low-confidence tables to review rather than into a system of record.
Python
Related
Output schema
The full cell and table field definitions.
Confidence Scoring
How Meibel scores the quality of extracted content.