agentleFS
kujiangmudaokujiangmudao/tablepack/skills/pdf-table-to-excel/SKILL.md

pdf-table-to-excel

Skill6 starsChanged 4 months agoMITView on GitHub

TablePack: Convert PDF tables to multi-sheet Excel packages with MinerU — original table screenshots, figures, QC notes, no fabricated data. Path A: existing MinerU users. Path B: run scripts/install_mineru.* first. REQUIRES multimodal/vision model for QC (open 原始表格/*.jpg). Triggers: 转表格, 转excel, 转Excel, PDF表格, pdf转excel, mineru, 原始表格, 批量转换, 继续转, 再转一批, 表格转excel, TablePack, /pdf-table-to-excel

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the model cannot see images:

    line 33
  2. Distinctive:

    Ask for a vision-capable model or human review for QC.

    line 37
  3. Very specific:

    Prefer config.yaml / env / CLI — do not hardcode another machine’s paths.

    line 41
  4. Distinctive:

    All tables → sheets in that one workbook.

    line 76
  5. Very specific:

    Always include 原始表格/ images for human comparison.

    line 77
  6. Distinctive:

    After auto convert: visual QC vs screenshots.

    line 78
  7. Very specific:

    Read *_content_list.json (prefer non-v2 with table_body HTML)

    line 96
  8. Distinctive:

    Check headers, dims, IDs, numbers against the screenshot

    line 115
  9. Very specific:

    Update output/_summary.json (pipeline writes it)

    line 139

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TablePack — PDF tables → Excel packages

Read root AGENTS.md first. This skill is the executable checklist.
Product name TablePack; CLI module remains python -m pdf_excel.

Who is the user?

PathAction before convert
A — already has MinerUConfirm mineru on PATH or config.yaml → mineru_bin. Do not require the user to learn MinerU CLI — only run TablePack.
B — no MinerUWindows: scripts/install_mineru.ps1 · Unix: scripts/install_mineru.sh. Activate .venv-mineru. See docs/INSTALL.md. Still no MinerU tutorial — only python -m pdf_excel.

Product promise: install MinerU (or Path B), put PDFs in pdf/, one command packages Excel + 原始表格/ + notes.

Model requirement (critical)

StageNeeds vision?Why
Run python -m pdf_excelNoCLI + MinerU HTML path
QC / fix sheetsYes — multimodalOpen 原始表格/*.jpg and compare to Excel

If the model cannot see images:

  1. Still run packaging.
  2. Do not claim “已严格质检”.
  3. Ask for a vision-capable model or human review for QC.

Environment (portable)

Prefer config.yaml / env / CLI — do not hardcode another machine’s paths.

ItemDefault
Entrypython -m pdf_excel or python convert_pipeline.py
PDFspdf/
Outputoutput/
MinerU cachework/mineru_raw/
MinerUconfig.yaml / MINERU_BIN / PATH / .venv-mineru
Output namesoutput_language in config: zh (default) → 原始表格/, 图片/, 转换说明.md; en → table_crops/, images/, conversion_notes.md

Recommended MinerU flags (also set in config):

mineru -p <pdf> -o work/mineru_raw -b pipeline -m auto -l ch -t true -f false

CPU-only → pipeline. Higher-accuracy VLM/hybrid only if installed and requested; QC still mandatory.

Required package layout

output/<PDF_STEM>/
  ├── <PDF_STEM>.xlsx
  ├── 原始表格/          # required screenshots
  ├── 图片/
  └── 转换说明.md | 问题说明.md

Names above follow output_language: zh (default). With output_language: en, use table_crops/, images/, conversion_notes.md / issues.md instead.

Business rules

  1. MinerU is primary parser; OCR/pdfplumber only for repair.
  2. One PDF → one Excel (same stem).
  3. All tables → sheets in that one workbook.
  4. Always include 原始表格/ images for human comparison.
  5. After auto convert: visual QC vs screenshots; rewrite bad sheets.
  6. Unrecoverable → markdown explanation; never invent cells.

Workflow

1. Prepare

  • PDFs in pdf/ (or user path)
  • List work items; respect skip-existing only if user asks

2. Parse

python -m pdf_excel --force   # or without --force to reuse cache
# filters:
python -m pdf_excel 关键词
  • Read *_content_list.json (prefer non-v2 with table_body HTML)
  • Collect type==table and image/chart

3. Excel

  • HTML (+ rowspan/colspan) → grid → openpyxl multi-sheet
  • Sheet names: 表N_中文标题 (≤31 chars)
  • Empty table_body → drop by default (drop_empty_tables)

4. Package

  • xlsx + 原始表格/ + 图片/ + notes
  • Rotate unreadable table crops before QC when needed

5. Forced QC (never skip) — vision step

For each sheet (multimodal):

  1. Open image: matching 原始表格/表N_*.jpg via vision / image read — not HTML alone
  2. Check headers, dims, IDs, numbers against the screenshot
  3. Fix xlsx immediately when wrong (openpyxl or rewrite sheet)
  4. Print conflicts → keep print + note
  5. Landscape disasters → rotate crop + OCR + manual rebuild

Checklist:

  • Sheet count / titles
  • Headers & dimensions
  • Symbols / subscripts
  • Values (spot-check full rows on the image)
  • Assets complete
  • Notes file present

6. Failures

CaseAction
No table objectsPlaceholder xlsx + 问题说明.md
Empty/broken HTMLRepair from image if possible; else document
Full failKeep folder + notes + partial assets

7. Close-out

  • Update output/_summary.json (pipeline writes it)
  • Report per-PDF table counts, fixes, known gaps

Forbidden

  • Deliver auto-only without QC
  • Mix multiple PDFs into one xlsx (unless user asks)
  • Omit 原始表格/
  • Fabricate data
  • Claim “strictly checked” without reading table images/values

Code map

ModuleRole
pdf_excel/pipeline.pyEnd-to-end packaging
pdf_excel/html_table.pyHTML → grid
pdf_excel/excel_writer.pyMulti-sheet xlsx
pdf_excel/clean.pyOCR normalizations
pdf_excel/cli.pyCLI
convert_pipeline.pyThin entry wrapper

New batches: pipeline → visual fix → notes. Optional local fix scripts stay out of git if they contain private data.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.