跳到正文
FunCoding

z-md-excel

Extract all Markdown tables from a .md file and export to Excel (.xlsx). Use this skill when the user wants to: convert Markdown tables to Excel, extract tables from .md files, export MD table data to spreadsheet, batch convert multiple tables from one Markdown file. Supports multiple tables, GFM alignment markers, inline Markdown stripping. Each table becomes a separate sheet in the output Excel file.

Star
687
最近提交
2026年11月22日

z-md-excel/SKILL.md

在 GitHub 上查看

z-md-excel

Extract all Markdown tables from a .md file and save them to a formatted Excel .xlsx file.

When to Use

Trigger this skill when the user asks to:

  • Convert/extract Markdown tables to Excel
  • Export tables from a .md file to .xlsx
  • Batch extract multiple tables from one Markdown file
  • Parse Markdown table data into a spreadsheet

Requirements

  • Python 3.7+
  • openpyxl: pip install openpyxl

Usage

Command Line

# Basic usage (output defaults to <input_name>.xlsx)
python scripts/md2xlsx.py input.md

# Specify output file
python scripts/md2xlsx.py input.md output.xlsx
  1. Identify the Markdown file the user wants to extract tables from.
  2. Ensure openpyxl is installed: pip install openpyxl
  3. Run the script:
    python /path/to/z-md-excel/scripts/md2xlsx.py <input.md> [output.xlsx]
    
  4. Report results: The script prints the number of tables found and their dimensions.

Programmatic (inline Python)

import sys
sys.path.insert(0, '/path/to/z-md-excel/scripts')
from md2xlsx import extract_tables, write_xlsx

tables = extract_tables('input.md')
write_xlsx(tables, 'output.xlsx')

Output Format

  • Each table becomes a separate sheet named Table_1, Table_2, etc.
  • Header row: Bold white text on blue background, centered
  • Data rows: Regular font, auto-fitted column widths
  • Alignment: Preserved from Markdown GFM markers (:--- left, :---: center, ---: right)
  • Frozen pane: Top row frozen for easy scrolling
  • Inline Markdown stripped: Bold, italic, code, links, images are converted to plain text

How It Works

  1. Reads the Markdown file line by line
  2. Detects table blocks (consecutive lines containing |)
  3. Skips lines inside code blocks (``` fenced blocks)
  4. Requires a GFM separator row (|---|---|) to validate a table
  5. Strips inline Markdown formatting from cell content
  6. Writes all tables to a single Excel file

Limitations

  • Only supports GFM-style pipe tables (| col1 | col2 |)
  • Does not support HTML <table> elements
  • Does not preserve complex Markdown formatting (converts to plain text)
  • Nested tables are not supported

File Structure

z-md-excel/
├── SKILL.md          # This file (Agent instructions)
├── README.md         # Human-readable documentation
└── scripts/
    └── md2xlsx.py    # Core extraction script

相似的 Skill

精选

pptx

生成、读取和修改演示文稿,也能合并拆分幻灯片。

ANanthropics/skills203k近 7 天新增 3,265 个 star

精选

docx

创建和编辑 Word 文档,支持目录、页码、页眉等排版。

ANanthropics/skills203k近 7 天新增 3,265 个 star

精选

pdf

提取文本和表格、合并拆分、填写表单,也能对扫描件做 OCR。

ANanthropics/skills203k近 7 天新增 3,265 个 star

精选

doc-coauthoring

按步骤协作撰写技术方案、提案和决策文档,逐轮修改。

ANanthropics/skills203k近 7 天新增 3,265 个 star

精选

xlsx

读写 Excel 和 CSV,处理公式、格式、图表与数据清洗。

ANanthropics/skills203k近 7 天新增 3,265 个 star

精选

canvas-design

按设计理念生成海报和视觉作品,输出 PNG 或 PDF。

ANanthropics/skills203k近 7 天新增 3,265 个 star