Skill 詳細
excel
General-purpose Excel file reading, writing, editing, formatting, and export.
使用前に確認
自動レビューは関連性のみを確認し、安全性や推奨を保証しません。使用前に出典の説明を読んでください。
SKILL.md
これはレビュー時に保存された抜粋です。完全で最新の内容は外部ソースを確認してください。
---
name: excel
description: Read, write, edit, and format Excel files (.xlsx). Create spreadsheets, manipulate data, apply formatting, manage sheets, merge cells, find/replace, and export to CSV/JSON/Markdown. Use for any Excel file manipulation task.
metadata: {"clawdbot":{"emoji":"📊","requires":{"bins":["python3"],"pip":["openpyxl"]}}}
---
# Excel
Comprehensive Excel file manipulation - read, write, edit, format, and export.
## Setup
```bash
pip install openpyxl
# Or use uv (recommended)
uv run --with openpyxl python3 scripts/excel.py --help
```
## Quick Reference
```bash
cd skills/excel
# Get file info
python3 scripts/excel.py info report.xlsx
# Read entire sheet
python3 scripts/excel.py read report.xlsx
python3 scripts/excel.py read report.xlsx --format markdown
python3 scripts/excel.py read report.xlsx --sheet "Sales" --range A1:D10
# Read specific cell
python3 scripts/excel.py cell report.xlsx B5
# Create new workbook
python3 scripts/excel.py create output.xlsx
python3 scripts/excel.py create output.xlsx --sheets "Data,Summary,Charts"
# Write data
python3 scripts/excel.py write output.xlsx --data '[[1,2,3],[4,5,6]]'
python3 scripts/excel.py write output.xlsx --data '{"headers":["Name","Age"],"rows":[["Alice",30],["Bob",25]]}'
# Edit a cell
python3 scripts/excel.py edit report.xlsx A1 "New Value"
python3 scripts/excel.py edit report.xlsx B2 "SUM(A1:A10)" --formula
# Export
python3 scripts/excel.py to-csv report.xlsx output.csv
python3 scripts/excel.py to-json report.xlsx output.json
python3 scripts/excel.py to-markdown report.xlsx
```
## Commands
### Reading Data
**info** - Get workbook metadata
```bash
python3 scripts/excel.py info report.xlsx
# Returns: sheets, dimensions, row/column counts
```
**read** - Read sheet data
```bash
python3 scripts/excel.py read file.xlsx # JSON output
python3 scripts/excel.py read file.xlsx --format csv # CSV output
python3 scripts/excel.py read file.xlsx --format markdown # Markdown table
python3 scripts/excel.py read file.xlsx --sheet "Sheet2" # Specific sheet
python3 scripts/excel.py read file.xlsx --range A1:D10 # Specific range
```
**cell** - Read a specific cell
```bash
python3 scripts/excel.py cell file.xlsx A1
python3 scripts/excel.py cell file.xlsx B5 --sheet "Data"
# Returns: value, formula (if any), data type, merge status
```
### Creating & Writing
**create** - Create new workbook
```bash
python3 scripts/excel.py create new.xlsx
python3 scripts/excel.py create new.xlsx --sheets "Sheet1,Sheet2,Summary"
```
**write** - Write data to cells
```bash
# 2D array
python3 scripts/excel.py write file.xlsx --data '[[1,2,3],[4,5,6]]'
# With headers
python3 scripts/excel.py write file.xlsx --data '{"headers":["A","B"],"rows":[[1,2],[3,4]]}'
# Start at specific cell
python3 scripts/excel.py write file.xlsx --data '[[1,2]]' --start C5
# Key-value pairs
python3 scripts/excel.py write file.xlsx --data '{"Name":"Alice","Age":30}'
```
**from-csv** - Create Excel from CSV
```bash
python3 scripts/excel.py from-csv data.csv output.xlsx
python3 scripts/excel.py from-csv data.csv output.xlsx --sheet "Imported"
```
**from-json** - Create Excel from JSON
```bash
python3 scripts/excel.py from-json data.json output.xlsx
# Supports: array of objects, array of arrays, headers+rows format
```
### Editing
**edit** - Edit a cell value or formula
```bash
python3 scripts/excel.py edit file.xlsx A1 "New Value"
python3 scripts/excel.py edit file.xlsx B2 100
python3 scripts/excel.py edit file.xlsx C3 "SUM(A1:B2)" --formula
python3 scripts/excel.py edit file.xlsx D4 "=VLOOKUP(A1,Data!A:B,2,FALSE)" --formula
```
**find** - Search for text
```bash
python3 scripts/excel.py find file.xlsx "search term"
python3 scripts/excel.py find file.xlsx "error" --sheet "Log"
# Returns: list of cells containing the text
```
**replace** - Find and replace
```bash
python3 scripts/excel.py replace file.xlsx "old" "new"
python3 scripts/excel.py replace file.xlsx "2024GitHub で全文を読む (外部ページ)