xlsx
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseXLSX Skill
XLSX Skill
Purpose
用途
Provides expertise in creating, reading, modifying, and automating Excel spreadsheet workflows. Specializes in programmatic spreadsheet manipulation using ExcelJS, SheetJS, pandas, and openpyxl for data processing, reporting, and automation.
提供创建、读取、修改Excel电子表格工作流及自动化的专业能力。专注于使用ExcelJS、SheetJS、pandas和openpyxl以编程方式操作电子表格,用于数据处理、报表生成和自动化任务。
When to Use
使用场景
- Creating Excel reports programmatically
- Reading and parsing XLSX files
- Modifying existing spreadsheets while preserving formatting
- Automating repetitive Excel tasks
- Converting between CSV and XLSX formats
- Building Excel templates with formulas
- Extracting data from complex spreadsheets
- Generating formatted financial or data reports
- 以编程方式创建Excel报表
- 读取和解析XLSX文件
- 修改现有电子表格并保留格式
- 自动化重复的Excel任务
- 在CSV与XLSX格式之间转换
- 构建带公式的Excel模板
- 从复杂电子表格中提取数据
- 生成格式化的财务或数据报表
Quick Start
快速开始
Invoke this skill when:
- Creating Excel reports programmatically
- Reading and parsing XLSX files
- Modifying existing spreadsheets while preserving formatting
- Automating repetitive Excel tasks
- Converting between CSV and XLSX formats
Do NOT invoke when:
- Creating Google Sheets → different API
- Building Excel add-ins → use appropriate .NET/JS skill
- Data analysis without Excel output → use data-analyst
- CSV-only operations → use csv-data-wrangler
在以下场景调用此技能:
- 以编程方式创建Excel报表
- 读取和解析XLSX文件
- 修改现有电子表格并保留格式
- 自动化重复的Excel任务
- 在CSV与XLSX格式之间转换
请勿在以下场景调用:
- 创建Google表格 → 使用不同的API
- 开发Excel插件 → 使用合适的.NET/JS技能
- 无需Excel输出的数据分析 → 使用数据分析师技能
- 仅CSV操作 → 使用csv-data-wrangler技能
Decision Framework
决策框架
Excel Task?
├── Node.js Environment → ExcelJS (full-featured) or SheetJS (parsing)
├── Python Environment → openpyxl (Excel) or pandas (data + Excel)
├── Heavy Data Processing → pandas with openpyxl engine
├── Complex Formatting → ExcelJS or openpyxl
├── Template-Based → Fill existing templates with data
└── Large Files → Streaming readers (ExcelJS streaming, pandas chunks)Excel Task?
├── Node.js Environment → ExcelJS (full-featured) or SheetJS (parsing)
├── Python Environment → openpyxl (Excel) or pandas (data + Excel)
├── Heavy Data Processing → pandas with openpyxl engine
├── Complex Formatting → ExcelJS or openpyxl
├── Template-Based → Fill existing templates with data
└── Large Files → Streaming readers (ExcelJS streaming, pandas chunks)Core Workflows
核心工作流
1. Excel Report Generation (Node.js)
1. Node.js Excel报表生成
- Initialize ExcelJS workbook
- Create worksheets with appropriate names
- Define columns with headers and widths
- Add data rows from source
- Apply styling (fonts, borders, fills)
- Add formulas for calculations
- Set print area and page setup
- Write to file buffer or stream
- 初始化ExcelJS工作簿
- 创建带有合适名称的工作表
- 定义包含表头和列宽的列
- 从数据源添加数据行
- 应用样式(字体、边框、填充)
- 添加用于计算的公式
- 设置打印区域和页面布局
- 写入文件缓冲区或流
2. Spreadsheet Data Extraction (Python)
2. Python电子表格数据提取
- Load workbook with openpyxl or pandas
- Identify data ranges and headers
- Handle merged cells and formatting
- Extract data into structured format
- Validate and clean extracted data
- Handle multiple sheets if needed
- Convert to desired output format
- 使用openpyxl或pandas加载工作簿
- 识别数据范围和表头
- 处理合并单元格和格式
- 将数据提取为结构化格式
- 验证并清洗提取的数据
- 如有需要,处理多个工作表
- 转换为所需的输出格式
3. Template-Based Reporting
3. 基于模板的报表生成
- Create master template with formatting and formulas
- Load template workbook
- Identify data insertion points
- Insert data while preserving formulas
- Update any date/reference cells
- Recalculate formulas if needed
- Save as new file (preserve template)
- 创建带有格式和公式的主模板
- 加载模板工作簿
- 识别数据插入点
- 在保留公式的前提下插入数据
- 更新日期/引用单元格
- 如有需要,重新计算公式
- 另存为新文件(保留原模板)
Best Practices
最佳实践
- Use streaming mode for large files to manage memory
- Preserve existing styles when modifying files
- Validate data types before writing to cells
- Handle merged cells explicitly
- Use named ranges for maintainability
- Test with actual Excel application, not just libraries
- 对大文件使用流模式以管理内存
- 修改文件时保留现有样式
- 写入单元格前验证数据类型
- 显式处理合并单元格
- 使用命名区域提升可维护性
- 用实际Excel应用测试,而非仅依赖库
Anti-Patterns
反模式
- Loading huge files in memory → Use streaming readers
- Hardcoding cell references → Use named ranges or dynamic lookup
- Ignoring data types → Explicitly set number, date, text types
- Overwriting formulas → Check cell types before writing
- Missing error handling → Handle corrupted/password-protected files
- 在内存中加载超大文件 → 使用流读取器
- 硬编码单元格引用 → 使用命名区域或动态查找
- 忽略数据类型 → 显式设置数字、日期、文本类型
- 覆盖公式 → 写入前检查单元格类型
- 缺少错误处理 → 处理损坏/受密码保护的文件