xberg-extracting-tables
できること
このスキルは、レイアウトを認識する検出方法で文書から表を取り出す方法を示します。財務諸表、請求書、研究用の表を使える形にしたい人向けです。
使う場面
- ✓PDFのレポート、請求書、財務諸表から表が必要なとき。
- ✓AIが読むために、表のデータをきれいなMarkdownとして取り出したいとき。
- ✓ほかのソフトで使うために、正確なセルの値を構造化ファイルにしたいとき。
スキルのリンク
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-tables/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“この財務諸表のPDFからすべての表を取り出し、表計算ソフトで開ける構造化ファイルにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ツールが表の境界を見つけられるようレイアウト検出を有効にします。そのうえで、選んだ出力形式に応じて、テキスト内のMarkdownの表か、セルの構造化リストを返します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
よくある質問
なぜレイアウトの設定を有効にするのですか?
無効だと、表は通常の文章として流し込まれ、セルの境界が失われるからです。
どの出力形式を選ぶべきですか?
AIに読ませるならMarkdownの表が向いています。正確なセルが必要なソフトには構造化リストが向いています。
表は常に正しく取り出されますか?
いいえ。このスキルには既知の限界が書かれているため、結果は元の文書と照らし合わせてください。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 9.5k
- ランキング
- #12271
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
xberg-batch-extraction
9.5kエージェントがXbergで多数の文書を一括処理できるよう支援します。共通の設定を使い、同時処理数を制限し、失敗したファイルで全体が止まらないようにします。
xberg-chunking
9.5kエージェントが長い文書のテキストを、AIのプロンプトや検索インデックス向けに小分けできるよう支援します。サイズと重なりを指定できます。
xberg-extracting-keywords
9.5kエージェントが、Xbergのキーワード設定を使って、文書の主なキーワードやキーフレーズを抽出し、言語を判定できるよう支援します。
xberg-extracting-with-ocr
9.5kエージェントが、テキストレイヤーのないスキャンPDF、写真、画像からOCRで文字を読み取れるよう支援します。言語パックを指定することもできます。
似ているスキル
feishu-doc
394kテキスト、画像、表を含むFeishuのクラウドドキュメントを、ドキュメントツールを使って読み、作成し、編集するようエージェントを支援します。
feishu-drive
394kボットと共有されたFeishuのクラウドフォルダ内のファイルを閲覧、整理、コメントできるようエージェントを支援します。
feishu-perm
394kFeishuのファイルにアクセスできる人を確認し、変更するようエージェントを支援します。依頼を満たす最小の権限を選びます。