xberg-extracting-tables
What it does
This skill shows how to get tables from documents using layout-aware detection. It is for people who need financial statements, invoices or research tables in a usable form.
When to use it
- ✓When you need the tables from a PDF report, invoice or financial statement.
- ✓When you want table data as clean markdown for an AI to read.
- ✓When you need exact cell values in a structured file for other software.
Skill link
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-tables/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Get all the tables from this financial statement PDF as a structured file I can open in a spreadsheet.”
5 new skills a week. 1 minute to read.
How it works
The agent turns on layout detection so the tool finds table boundaries, then returns either markdown tables in the text or a structured list of cells, depending on the output you pick.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Extracting tables
Use this when the user wants structured tabular data — financial statements, scientific tables, invoices, spreadsheet-style PDFs. Xberg detects tables via a layout model (RT-DETR v2) and reconstructs cell structure with a configurable table model.
Basic usage
# Markdown tables embedded in the content stream
xberg extract report.pdf --layout --content-format markdown
# Structured JSON output, tables appear under result.tables
xberg extract report.pdf --layout --format json
--layout turns on layout-aware extraction; without it, tables fall back
to plain text reflow and you lose cell boundaries.
Output shapes
Two surfaces, picked via --format (CLI shape) and --content-format
(content rendering):
- Markdown tables in
content—--content-format markdown. Tables appear inline as| col | col |blocks. Good for LLM ingestion. - Structured
tablesarray —--format json. Each entry hascells[][](rows × cols),markdown(pre-rendered),page_number,bounding_box. Use this when downstream code needs exact cell access. (bounding_boxis omitted when no position data is available.)
Both are populated at once when --layout is on. The tables array is
always structured; the content stream switches representation.
xberg extract financials.pdf --layout --format json \
| jq '.result.tables[] | {page: .page_number, rows: (.cells | length)}'
Table models
--layout-table-model picks the reconstruction backend:
| Model | Best for | Notes |
|---|---|---|
tatr |
dense complex tables (academic, financial) | Default. Heaviest, highest accuracy. |
slanet_auto |
dispatches per-table to wired/wireless | Good when table styles are mixed. |
slanet_wired |
tables with visible borders | Faster than tatr. |
slanet_wireless |
tables without borders (whitespace-separated) | For invoices, simple grids. |
slanet_plus |
hybrid wired / wireless | Lighter than slanet_auto. |
disabled |
layout detection only, no table structure | Use to skip table model cost. |
xberg extract bank-statement.pdf \
--layout --layout-table-model tatr --content-format markdown
Drop --layout-confidence when the layout model misses tables (default
threshold ~0.5):
xberg extract noisy-scan.pdf --layout --layout-confidence 0.3
Spreadsheets
.xlsx, .ods, .csv, .tsv are extracted by dedicated parsers — no
layout model needed. Each sheet becomes a markdown table (or structured
table) automatically:
xberg extract workbook.xlsx --content-format markdown
xberg extract data.csv --format json
Pass --no-cache=true only when iterating on the same file with different
configs.
Config file alternative
# `output_format` in config files equals `--content-format` on the CLI.
output_format = "markdown"
[layout]
confidence_threshold = 0.5
table_model = "tatr"
Then:
xberg extract report.pdf --format json
Programmatic access
From Python, structured tables live on the document in the result envelope
(result.results[0].tables):
from xberg import ExtractInput, extract, ExtractionConfig, LayoutDetectionConfig
config = ExtractionConfig(
layout=LayoutDetectionConfig(table_model="tatr"),
output_format="markdown",
)
result = await extract(ExtractInput(uri="report.pdf"), config)
for table in result.results[0].tables:
print(table.markdown) # rendered markdown
print(table.cells[0][0]) # cell access
Node.js mirrors this (extract, output.results[0].tables, camelCase fields).
See ../../references/python-api.md and ../../references/nodejs-api.md for full type signatures.
Known limitations
- Merged cells — reconstructed as repeated values across the spanned region; the merge is not preserved as metadata.
- Rotated tables — enable
--ocr-auto-rotate truefor image-based PDFs before extraction. - Nested tables — flattened. Detection succeeds; structural nesting is lost.
- **Multi-page table
FAQ
Why turn on the layout setting?
Without it, tables are reflowed as plain text and the cell boundaries are lost.
Which output should I choose?
Markdown tables suit AI reading, while the structured list suits software that needs exact cells.
Does it always get tables right?
No. The skill lists known limits, so check the result against the original document.
Details
Original description by the author
Use when extracting tabular data from PDFs, spreadsheets, or images. Covers layout-aware table detection, table model selection, output formats (markdown / JSON cells), and known limits.
repo: xberg-io/xberg
Popularity
- GitHub stars
- 9.5k
- Ranking position
- #12271
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
xberg-batch-extraction
9.5kHelps your agent process many documents at once with Xberg, sharing one set of options, limiting parallel work and keeping failed files from stopping the run.
xberg-chunking
9.5kHelps your agent split long document text into smaller pieces for AI prompts or search indexes, with set sizes and optional overlap.
xberg-extracting-keywords
9.5kHelps your agent pull the main keywords or key phrases from a document and detect its language, using Xberg's keyword settings.
xberg-extracting-with-ocr
9.5kHelps your agent read text from scanned PDFs, photos and images that have no text layer, using OCR with optional language packs.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.