
office-automation
Automate Word and Excel file processing using Python scripts. Supports reading, writing, formatting documents and spreadsheets, batch processing, template filling, data extraction, and format conversion.
6stars
3forks
Updated 2/22/2026
Related Skills
SKILL.md
read-only
name
office-automation
description
Automate Word and Excel file processing using Python scripts. Supports reading, writing, formatting documents and spreadsheets, batch processing, template filling, data extraction, and format conversion.
Office Automation Skill
Automate Word (.docx) and Excel (.xlsx/xlsm) file processing using Python scripts.
Quick Start
1. Install Dependencies
pip install python-docx openpyxl pandas
2. Basic Usage
Word Documents:
python scripts/word_processor.py read document.docx
python scripts/word_processor.py write output.docx --content "Hello World"
python scripts/word_processor.py template fill.docx --data '{"name": "张三", "date": "2026-02-22"}'
Excel Spreadsheets:
python scripts/excel_processor.py read data.xlsx
python scripts/excel_processor.py write output.xlsx --sheet "Sheet1"
python scripts/excel_processor.py merge folder/ --output merged.xlsx
Script Reference
word_processor.py
| Command | Description | Example |
|---|---|---|
read |
Read Word document content | read file.docx |
write |
Create a new document | write out.docx --content "文本" |
template |
Fill template (replace {{variables}}) | template doc.docx --data '{"key": "value"}' |
extract |
Extract tables to CSV | extract file.docx --table 1 |
format |
Format document | format file.docx --style heading |
excel_processor.py
| Command | Description | Example |
|---|---|---|
read |
Read Excel data | read data.xlsx --sheet Sheet1 |
write |
Write data to Excel | write out.xlsx --data data.json |
merge |
Merge multiple Excel files | merge folder/ --output all.xlsx |
convert |
Convert Excel ↔ CSV | convert file.xlsx --to csv |
analyze |
Data analysis (statistics, pivot) | analyze sales.xlsx --pivot |
Use Cases
Word Processing
- 📝 Batch generate reports/contracts
- 📋 Fill template documents
- 📊 Extract table data from documents
- 🎨 Unify document formatting
Excel Processing
- 📈 Data consolidation and merging
- 🔄 Format conversion (Excel ↔ CSV)
- 📊 Data analysis and statistics
- 📋 Batch process multiple spreadsheets
Notes
- Word format: Only .docx is supported (not legacy .doc)
- Excel format: Supports .xlsx and .xlsm
- Encoding: UTF-8 by default
- Large files: Process files over 100MB in batches
Script Location
All scripts are in the skills/office-automation/scripts/ directory.
Run them from the skill directory or the workspace root.





