home / skills / aidotnet / moyucode / excel-handler

excel-handler skill

/skills/tools/excel-handler

This skill helps you read, write, and manipulate Excel files programmatically, exporting data and applying formulas and styling.

npx playbooks add skill aidotnet/moyucode --skill excel-handler

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---
name: excel-handler
description: 读取、写入和操作Excel文件(.xlsx、.xls)。创建电子表格、读取数据并导出为各种格式。
metadata:
  short-description: 读写Excel文件
source:
  repository: https://github.com/python-excel/xlrd
  license: BSD
---

# Excel Handler Tool

## Description
Read, write, and manipulate Excel spreadsheets with support for formulas, styling, and data export.

## Trigger
- `/excel` command
- User requests Excel file operations
- User needs to read or create spreadsheets

## Usage

```bash
# Read Excel to JSON
python scripts/excel_handler.py read --input data.xlsx --output data.json

# Create Excel from JSON/CSV
python scripts/excel_handler.py create --input data.json --output report.xlsx

# Convert Excel to CSV
python scripts/excel_handler.py convert --input data.xlsx --output data.csv

# Merge multiple Excel files
python scripts/excel_handler.py merge --inputs file1.xlsx,file2.xlsx --output merged.xlsx
```

## Tags
`excel`, `spreadsheet`, `xlsx`, `csv`, `data`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill reads, writes, and manipulates Excel spreadsheets (.xlsx, .xls) with support for formulas, styling, and data export. It lets you create workbooks, extract sheet data, convert between formats, and merge or transform files programmatically. Designed for TypeScript/Node environments, it exposes commands for common Excel workflows.

How this skill works

The skill inspects Excel files to parse sheets, cell values, formulas, and styling metadata, then converts those structures into in-memory objects. It can generate new workbooks from JSON or CSV sources, apply cell styles and formulas, and export to formats like CSV or JSON. Batch operations such as merging multiple workbooks or converting multiple files are supported via command triggers.

When to use it

  • Extract structured data from .xlsx or .xls files into JSON or CSV for downstream processing.
  • Generate reports or templates programmatically from JSON or CSV inputs.
  • Convert spreadsheets to CSV for ingestion by databases or analytics tools.
  • Merge several Excel files into a single workbook while preserving sheets and formulas.
  • Automate repetitive spreadsheet transformations and styling in a CI pipeline.

Best practices

  • Validate input files and sheet names before running large batch operations to avoid data loss.
  • Prefer JSON as an intermediate format when preserving complex cell types or formulas.
  • Use streaming or chunked reads for very large spreadsheets to reduce memory usage.
  • Keep a schema for exported JSON/CSV to ensure consistent downstream parsing.
  • Test transformations on sample files before applying to production datasets.

Example use cases

  • Read sales.xlsx, convert the main sheet to JSON, and feed it into a reporting API.
  • Create a monthly report by combining CSV exports into a styled report.xlsx with formulas.
  • Merge regional workbooks (region1.xlsx, region2.xlsx) into a consolidated merged.xlsx for finance.
  • Convert a bulk folder of .xlsx files to .csv for import into a data warehouse.
  • Generate template spreadsheets from JSON definitions with pre-set formulas and styling.

FAQ

Which Excel formats are supported?

The skill supports common Excel formats (.xlsx and .xls) and can export to CSV and JSON.

Can it preserve formulas and cell styles?

Yes — formulas and basic styling metadata are preserved when reading and writing workbooks, though advanced formatting may vary by exporter.