Skip to main content

Extract PDF Table

Extracts tabular data from a PDF using gopdf's table detection. Provide header anchors to locate the table precisely, or leave headers empty for auto-detection. Returns {columns, rows} where rows are header-keyed maps. Prefer this over RunPython with manual span geometry for any table-shaped PDF extraction (invoices, spec lists, statements). Handles multi-line cells (mergeGap), table-end detection (maxRowGap), and cross-page continuations.

Category: Structured Data Files (Excel, JSON, PDF) · Group: Files · Activity name: ExtractPDFTable

The ExtractPDFTable activity in the designer

Example

outputVariable = ExtractPDFTable("<filePath>", headers=[], mergeGap=0.0, maxRowGap=0.0, anchorColumn="<anchorColumn>", requireAnyColumn=[])

Inputs

NameTypeRequiredDefaultDescription
PDF File PathstringYesPath to the PDF file to extract the table from.
Header AnchorsarrayColumn header strings that identify the table's header row (case-insensitive substring match on the same Y-line). Leave empty for auto-detection via gap analysis.
Merge Gap (pt)floatMaximum vertical distance between consecutive rows to merge them into a single logical row (multi-line cell support, e.g. bank statements). Default: 0 (no merging).
Max Row Gap (pt)floatMaximum vertical distance between consecutive data rows; rows beyond this gap end the table (useful for stopping at footers). Default: 0 (no limit).
Anchor ColumnstringColumn name that signals the start of a new logical row. Consecutive rows where this column is empty merge into the previous row. Case-insensitive.
Require Any ColumnarrayColumn names where at least one must be non-empty for a row to be included. Rows where all listed columns are empty are dropped.

Outputs

NameTypeDescription
outputVariablejsonJSON object with the detected table: - columns: Array of column names (in page order) - rows: Array of row objects keyed by column name Example: {{ map(table.rows, .["Suppliers Code"]) }} to pull one column; {{ filter(table.rows, .["Qty"] matches "[0-9]+") }} to filter.