xberg-extracting-tables
Skill này làm gì
Skill này chỉ cách lấy bảng từ tài liệu bằng cách phát hiện bố cục. Nó dành cho người cần bảng từ báo cáo tài chính, hóa đơn hoặc bảng nghiên cứu ở dạng dùng được.
Khi nào nên dùng
- ✓Khi bạn cần các bảng từ một PDF báo cáo, hóa đơn hoặc báo cáo tài chính.
- ✓Khi bạn muốn dữ liệu bảng ở dạng markdown sạch để AI đọc.
- ✓Khi bạn cần giá trị ô chính xác trong một file có cấu trúc cho phần mềm khác.
Liên kết skill
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-tables/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Lấy tất cả các bảng từ file PDF báo cáo tài chính này dưới dạng một file có cấu trúc mà tôi có thể mở trong bảng tính.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent bật cài đặt phát hiện bố cục để công cụ tìm được ranh giới bảng, rồi trả về các bảng markdown trong văn bản hoặc danh sách ô có cấu trúc, tùy vào đầu ra bạn chọn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Vì sao phải bật cài đặt bố cục?
Nếu không bật, các bảng sẽ bị dàn lại thành văn bản thường và ranh giới ô sẽ mất.
Nên chọn đầu ra nào?
Bảng markdown phù hợp cho AI đọc, còn danh sách có cấu trúc phù hợp cho phần mềm cần đúng từng ô.
Skill có luôn lấy đúng bảng không?
Không. Skill liệt kê các giới hạn đã biết, nên hãy đối chiếu kết quả với tài liệu gốc.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 9.5k
- Vị trí xếp hạng
- #12271
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
xberg-batch-extraction
9.5kGiúp agent của bạn xử lý nhiều tài liệu một lượt với Xberg, dùng chung tùy chọn, giới hạn việc song song và không để một file lỗi làm dừng cả lượt.
xberg-chunking
9.5kGiúp agent của bạn chia văn bản dài thành các đoạn nhỏ cho prompt AI hoặc chỉ mục tìm kiếm, với kích thước đặt sẵn và chồng lấp tùy chọn.
xberg-extracting-keywords
9.5kGiúp agent của bạn lấy các từ khóa chính hoặc cụm từ khóa từ tài liệu và nhận diện ngôn ngữ của tài liệu, bằng các cài đặt từ khóa của Xberg.
xberg-extracting-with-ocr
9.5kGiúp agent của bạn đọc văn bản từ PDF quét, ảnh chụp và hình ảnh không có lớp văn bản, bằng OCR với các gói ngôn ngữ tùy chọn.
Skill tương tự
feishu-doc
394kGiúp agent của bạn đọc, tạo và sửa tài liệu đám mây Feishu, gồm văn bản, hình ảnh và bảng, bằng công cụ tài liệu.
feishu-drive
394kCho phép agent của bạn duyệt, sắp xếp và bình luận các file trong một thư mục đám mây Feishu đã được chia sẻ với bot.
feishu-perm
394kGiúp agent của bạn kiểm tra và thay đổi ai có quyền truy cập một file Feishu, chọn quyền nhỏ nhất đáp ứng yêu cầu của bạn.