# Xberg Extracting Tables

Use when extracting tabular data from PDFs, spreadsheets, or images.

- Repository: https://github.com/xberg-io/xberg (9506 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add xberg-io/xberg --skill xberg-extracting-tables -g -a claude-code -y`
Codex: `npx skills add xberg-io/xberg --skill xberg-extracting-tables -g -a codex -y`
Cursor: `npx skills add xberg-io/xberg --skill xberg-extracting-tables -g -a cursor -y`
Gemini CLI: `npx skills add xberg-io/xberg --skill xberg-extracting-tables -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add xberg-io/xberg`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

<!--
AI-RULEZ :: GENERATED FILE, DO NOT EDIT
Content-Hash: blake3:80d26904ff70da39df4ee2b35bcfc06a186b30c0d2566cf4b60832cd42e475ef
Source-Hash: blake3:4a90223a333b0f963ae8cdec4f38db88b769132c5dd1b7f39a7fe8e84f57f83e
Schema-Version: v1
-->

# 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

```bash
# 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 `tables` array**, `--format json`. Each entry has
  `cells[][]` (rows × cols), `markdown` (pre-rendered), `page_number`,
  `bounding_box`. Use this when downstream code needs exact cell access.
  (`bounding_box` is 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.

```bash
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:

The rest: https://github.com/xberg-io/xberg/blob/HEAD/plugin/.cursor-plugin/skills/xberg-extracting-tables/SKILL.md
