mcpField
E
excel-parser

excel-parser

github.com/yejinleiDocuments087 installsUpdated 33w ago
Repository

About excel-parser

excel-parser is a skill for extracting content from and writing to Excel files with Python. It supports several workbook and template formats, with configurable row limits and empty-row handling.

Key features

  1. 01Extract Excel file content
  2. 02Write to and update workbooks
  3. 03Support workbook and template formats
  4. 04Configure maximum rows read
  5. 05Choose whether to keep empty rows

Use cases

  1. 01Extract sheets as text and tabular data
  2. 02Write new content to Excel files
  3. 03Update existing workbooks
  4. 04Process Excel template files

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/yejinlei/excel-parser-skill --skill excel-parser

After installing, type/excel-parserin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.env.example
README.md
CHANGELOG.md
MANIFEST.in
LICENSE.txt
.gitignore
requirements.txt
setup.py
发布检查清单.md
发布指南.md
.github/workflows/
python-publish.yml
scripts/
__init__.py
excel_parser.py
test_skill_write.py

Details

From the project README

Excel Parser Skill

Excel Parser技能用于从Excel文件中提取内容和写入内容,支持多种Excel格式。

Compatibility

  • Python 3.7+
  • 依赖: python-dotenv, python-calamine
  • 备选依赖: xlwings (用于所有Excel格式)

使用方法

基本使用
from excel_parser import ExcelParser, process_excel, write_excel_file, update_excel_file

# 方法1: 使用ExcelParser类
parser = ExcelParser()

# 读取Excel文件
result = parser.parse_excel('path/to/file.xlsx')

# 获取文本格式输出
text = parser.parse_excel_to_text('path/to/file.xlsx')

# 写入Excel文件
write_data = {
    "sheets": [
        {
            "name": "Sheet1",
            "rows": [["A1", "B1"], ["A2", "B2"]],
            "merged_cells": [
                {
                    "start_row": 0,
                    "end_row": 0,
                    "start_col": 0,
                    "end_col": 1
                }
            ]
        }
    ]
}
parser.write_excel('output.xlsx', write_data)

# 更新Excel文件
parser.update_excel('existing_file.xlsx', write_data)

# 方法2: 使用便捷函数
# 读取Excel文件
result = process_excel('path/to/file.xlsx')

# 写入Excel文件
write_result = write_excel_file('output.xlsx', write_data)

# 更新Excel文件
update_result = update_excel_file('existing_file.xlsx', write_data)
返回结果格式
{
    "text": "格式化的文本内容",
    "sheets": [
        {
            "name": "Sheet1",
            "rows": [["A1", "B1"], ["A2", "B2"]],
            "row_count": 2,
            "column_count": 2
        }
    ],
    "sheet_count": 1,
    "total_cells": 4,
    "engine": "python-calamine"
}

支持的文件格式

  • .xls (Excel 97-2003)
  • .xlsx, .xlsm (Excel 2007+)
  • .xltx, .xltm (Excel模板)

环境变量配置

创建 .env 文件:

# 最大行数限制,默认100行
EXCEL_MAX_ROWS=100

# 是否保留空行,默认false
EXCEL_KEEP_EMPTY_ROWS=false

详细文档

更多使用示例和故障排除信息,参见 README.md。

Comments

Markdown supported