SuperAPI AI Directory

office-automation

Office & productivity

View repository

Updated 10-16 09:44

About this skill

Office Automation Skill

Use Python scripts to automate the processing of Word (.docx) and Excel (.xlsx/xlsm) files.

Quick Start

1. Install dependencies

pip install python-docx openpyxl pandas

2. Basic usage

Process 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"}'

Process 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 Description

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 a template (replace {{variable}}) template doc.docx --data '{"key": "value"}'
extract Extract tables to CSV extract file.docx --table 1
format Format a 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 Excel ↔ CSV conversion 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 formats

Excel Processing

  • 📈 Data aggregation and merging
  • 🔄 Format conversion (Excel ↔ CSV)
  • 📊 Data analysis and statistics
  • 📋 Batch process multiple spreadsheets

Notes

  1. Word format: Only .docx format is supported (legacy .doc is not supported)
  2. Excel format: Supports .xlsx and .xlsm
  3. Encoding: UTF-8 encoding is used by default
  4. Large files: Files larger than 100MB are recommended to be processed in batches

Script Location

All scripts are located in the skills/office-automation/scripts/ directory.

When using, please make sure to run from the skill directory or the workspace root directory.