mcpField
E
excel

excel

github.com/sundial-orgドキュメント670291 回インストール34 週間前に更新
リポジトリ

excel について

付属の Python スクリプトで Excel ブックの読み取り、作成、編集、書式設定、エクスポートを行うコマンドラインスキルです。表の更新やデータ抽出を自動化する用途に向いています。

主な機能

  1. 01ブック情報、シート、範囲、セルの読み取り
  2. 02CSV または JSON からのブック作成
  3. 03セル値や数式の書き込みと編集
  4. 04シート、行、列、結合セルの管理
  5. 05セル書式、サイズ変更、ウィンドウ枠の固定
  6. 06CSV、JSON、Markdown へのエクスポート

活用シーン

  1. 01指定したシートや範囲を分析用に抽出
  2. 02JSON データから書式付きレポートを作成
  3. 03既存ブックの数式や値を更新
  4. 04ブック内のテキストを検索・置換

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/sundial-org/awesome-openclaw-skills --skill excel

インストール後、Claude Code で/excelを入力して読み込まれたか確認します。

同梱ファイルscripts/excel.py

詳細

Excel

Excel ファイルを包括的に操作します。読み取り、書き込み、編集、書式設定、エクスポートに対応しています。

セットアップ

pip install openpyxl

# Or use uv (recommended)
uv run --with openpyxl python3 scripts/excel.py --help

クイックリファレンス

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

コマンド

データの読み取り

info - ブックのメタデータを取得

python3 scripts/excel.py info report.xlsx
# Returns: sheets, dimensions, row/column counts

read - シートのデータを読み取り

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 - 特定のセルを読み取り

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
作成と書き込み

create - 新しいブックを作成

python3 scripts/excel.py create new.xlsx
python3 scripts/excel.py create new.xlsx --sheets "Sheet1,Sheet2,Summary"

write - セルにデータを書き込み

# 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 - CSV から Excel ファイルを作成

python3 scripts/excel.py from-csv data.csv output.xlsx
python3 scripts/excel.py from-csv data.csv output.xlsx --sheet "Imported"

from-json - JSON から Excel ファイルを作成

python3 scripts/excel.py from-json data.json output.xlsx
# Supports: array of objects, array of arrays, headers+rows format
編集

edit - セルの値または数式を編集

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 - テキストを検索

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 - 検索して置換

python3 scripts/excel.py replace file.xlsx "old" "new"
python3 scripts/excel.py replace file.xlsx "2024" "2025" --sheet "Dates"
シートの管理

add-sheet - 新しいシートを追加

python3 scripts/excel.py add-sheet file.xlsx "NewSheet"
python3 scripts/excel.py add-sheet file.xlsx "First" --position 0  # Insert at beginning

rename-sheet - シート名を変更

python3 scripts/excel.py rename-sheet file.xlsx "Sheet1" "Data"

delete-sheet - シートを削除

python3 scripts/excel.py delete-sheet file.xlsx "OldSheet"

copy-sheet - シートをコピー

python3 scripts/excel.py copy-sheet file.xlsx "Template" "January"
行と列の操作

insert-rows - 行を挿入

python3 scripts/excel.py insert-rows file.xlsx 5              # Insert 1 row at row 5
python3 scripts/excel.py insert-rows file.xlsx 5 --count 3    # Insert 3 rows

insert-cols - 列を挿入

python3 scripts/excel.py insert-cols file.xlsx C              # Insert at column C
python3 scripts/excel.py insert-cols file.xlsx 3 --count 2    # Insert 2 cols at position 3

delete-rows - 行を削除

python3 scripts/excel.py delete-rows file.xlsx 5
python3 scripts/excel.py delete-rows file.xlsx 5 --count 3

delete-cols - 列を削除

python3 scripts/excel.py delete-cols file.xlsx C
python3 scripts/excel.py delete-cols file.xlsx B --count 2
セルの操作

merge - セルを結合

python3 scripts/excel.py merge file.xlsx A1:C1
python3 scripts/excel.py merge file.xlsx A1:A5 --sheet "Header"

unmerge - セルの結合を解除

python3 scripts/excel.py unmerge file.xlsx A1:C1
書式設定

format - セルの書式を適用

# Bold and italic
python3 scripts/excel.py format file.xlsx A1:D1 --bold --italic

# Font settings
python3 scripts/excel.py format file.xlsx A1:D1 --font-size 14 --font-color RED --font-name "Arial"

# Background color
python3 scripts/excel.py format file.xlsx A1:D1 --bg-color YELLOW

# Alignment
python3 scripts/excel.py format file.xlsx A:A --align center --valign top

# Text wrapping
python3 scripts/excel.py format file.xlsx B2:B100 --wrap

# Borders
python3 scripts/excel.py format file.xlsx A1:D10 --border thin
# Border styles: thin, medium, thick, double

# Combined
python3 scripts/excel.py format file.xlsx A1:D1 --bold --bg-color "#4472C4" --font-color WHITE --align center

resize - 行と列のサイズを変更

python3 scripts/excel.py resize file.xlsx --row 1:30          # Row 1 height = 30
python3 scripts/excel.py resize file.xlsx --col A:20          # Column A width = 20
python3 scripts/excel.py resize file.xlsx --row 1:30 --col A:15 --col B:25

freeze - ウィンドウ枠を固定

python3 scripts/excel.py freeze file.xlsx A2    # Freeze row 1
python3 scripts/excel.py freeze file.xlsx B1    # Freeze column A
python3 scripts/excel.py freeze file.xlsx B2    # Freeze row 1 and column A
エクスポート

to-csv - CSV にエクスポート

python3 scripts/excel.py to-csv file.xlsx output.csv
python3 scripts/excel.py to-csv file.xlsx data.csv --sheet "Data"

to-json - JSON にエクスポート(先頭行をヘッダーとして使用)

python3 scripts/excel.py to-json file.xlsx output.json
# Outputs: [{"Header1": "val1", "Header2": "val2"}, ...]

to-markdown - Markdown テーブルにエクスポート

python3 scripts/excel.py to-markdown file.xlsx
python3 scripts/excel.py to-markdown file.xlsx --sheet "Summary"

色

色名:RED、GREEN、BLUE、YELLOW、WHITE、BLACK、GRAY、ORANGE、PURPLE、PINK、CYAN

16 進数カラー:#FF0000、#4472C4、00FF00(# の有無はどちらでも可)

よく使うワークフロー

データからレポートを作成
# Create workbook with data
python3 scripts/excel.py from-json sales.json report.xlsx --sheet "Sales"

# Format headers
python3 scripts/excel.py format report.xlsx A1:E1 --bold --bg-color "#4472C4" --font-color WHITE

# Freeze header row
python3 scripts/excel.py freeze report.xlsx A2

# Resize columns
python3 scripts/excel.py resize report.xlsx --col A:15 --col B:25 --col C:12
既存のレポートを更新
# Add new row
python3 scripts/excel.py insert-rows report.xlsx 2
python3 scripts/excel.py write report.xlsx --data '[["New Item", 100, 50]]' --start A2

# Update specific cell
python3 scripts/excel.py edit report.xlsx D10 "=SUM(D2:D9)" --formula

# Find and replace dates
python3 scripts/excel.py replace report.xlsx "2024" "2025"
分析用のデータを抽出
# Read as JSON for processing
python3 scripts/excel.py read data.xlsx --format json > data.json

# Read specific range as markdown
python3 scripts/excel.py read data.xlsx --range A1:D20 --format markdown

# Export specific sheet to CSV
python3 scripts/excel.py to-csv data.xlsx --sheet "Raw Data" export.csv

出力形式

すべてのコマンドは、success: true/false を含む JSON を出力します。

{
  "success": true,
  "file": "report.xlsx",
  "sheet": "Sheet1",
  ...
}

別の出力形式を使用するには、read コマンドで --format markdown または --format csv を指定します。

コメント