1---2name: extract-tables-from-pdf3description: Extracts tables from PDF or scanned text into clean CSV, Markdown or JSON, keeps values exactly as printed, flags likely OCR errors and validates totals against the source. Use before analysis.4license: CC0-1.05arguments:6 - source7 - output_format8argument-hint: <source> [output_format]9disable-model-invocation: true10metadata:11 version: 1.0.012 kind: prompt13 category: spreadsheets14 source: https://skillmd.com/skills/hermes-hq/extract-tables-from-pdf15 upstream: https://hermes-ide.com/prompts/extract-tables-from-pdf16 catalog: 2026.1014.117---1819# Extract tables from a PDF2021## Inputs2223- `source` (required): The text copied or OCR'd from the PDF pages containing the tables, including headers, footnotes and page numbers.24- `output_format` (optional; one of: csv, markdown-table, json; default: csv): Format for the extracted tables.2526Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.2728<context>29Text copied from PDFs loses table structure: columns run together, multi-line cells split into separate rows, headers span several lines, tables continue across pages with repeated headers, and scanned pages add OCR errors such as O for 0, l for 1 or a dropped decimal point. Financial and statistical tables also carry meaning outside the cells: units in the title ("in thousands of EUR"), negatives in parentheses, footnote markers and subtotal rows. A clean extraction preserves every printed value and proves itself by re-adding the totals.30</context>3132<task>33Extract every table from this source as $output_format:34<source>35$source36</source>37381. Find each table and give it a name from its title or caption, with the page if shown.392. Rebuild the structure: one header row (flatten multi-level headers as "Parent - Child"), one row per record, multi-line cells joined, and tables that continue across pages merged with repeated headers removed.403. Normalise numbers for machine use: remove thousands separators, turn parentheses into a leading minus sign, keep the decimal places printed, and move units and scale into the column name (for example "revenue_eur_thousands"). Keep "-", "n/a" and blank cells as empty values and list them.414. Keep footnote markers out of numeric cells and put them in a separate notes column or list.425. Keep subtotal and total rows, labelled as such in a row-type column, so they can be validated and then filtered out.436. Validate: recompute every printed total and subtotal (rows and columns) from the extracted values and compare. Report each match and each mismatch with the difference.447. Flag suspected OCR errors: characters inside numbers, implausible magnitudes, misaligned columns, and totals that fail by an amount that suggests a single misread digit.45</task>4647<constraints>48- Never change a printed value to make a total work. Report the mismatch and the likely culprit instead.49- Never fill an empty or unreadable cell with a guess; leave it empty and list it.50- Output each table in a separate fenced block. For csv, use commas, quote fields that contain commas, and put the header in the first line. For json, give an array of objects per table with the column names as keys and numbers as numbers.51- If the source has no recognisable table, or the text is too garbled to rebuild columns reliably, say so and ask for a better copy (for example exported text, a higher-resolution scan or the page image) rather than producing a doubtful table.52</constraints>5354<output_format>55## Tables found56For each table: its name, page, row and column count, then the table in a fenced block.57## Validation58A table: table | total checked | printed | recomputed | result (match / mismatch and difference).59## Issues to check60Bullets: empty cells, suspected OCR errors and structural guesses, each with its location.61</output_format>