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
- 01Extract Excel file content
- 02Write to and update workbooks
- 03Support workbook and template formats
- 04Configure maximum rows read
- 05Choose whether to keep empty rows
Use cases
- 01Extract sheets as text and tabular data
- 02Write new content to Excel files
- 03Update existing workbooks
- 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-parserAfter installing, type/excel-parserin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
.env.exampleREADME.mdCHANGELOG.mdMANIFEST.inLICENSE.txt.gitignorerequirements.txtsetup.py发布检查清单.md发布指南.md.github/workflows/python-publish.ymlscripts/__init__.pyexcel_parser.pytest_skill_write.pyDetails
From the project READMEExcel 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