Communityコーディング&開発github.com

XLSX 作成・編集・分析

スプレッドシートファイル(.xlsx, .xlsm, .xltx, .csv, .tsv)を開く、読み取る、編集する、作成する、変換する、またはクリーンアップするあらゆるタスクに使用します。

XLSX 作成・編集・分析 とは?

このスキルは、AIエージェント(Claude Code、Cursor、Codexなど)がスプレッドシートファイルを扱うための包括的な機能を提供します。openpyxl、pandas、markitdown、LibreOfficeを活用し、数式の作成・編集、書式設定、チャート作成、データの一括読み込み・書き出し、ファイル形式間の変換などをサポートします。特に、数式を含むファイルの再計算(recalc.py)、外部参照リンクの保持、マクロを含む.xlsmファイルの扱いなど、実務で遭遇する落とし穴を回避するための詳細なガイドラインが含まれています。金融モデル向けの色分け規則や数値書式も標準で提供されており、プロフェッショナルな成果物を確実に生成できます。すべての出力ファイルは、プロフェッショナルフォントの使用、数式エラーゼロ、既存ファイルの規則の尊重が要求されます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/anthropics/skills/tree/main/skills/xlsx

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

XLSX 作成、編集、分析

タスクアプローチ
作成または編集(数式・書式あり)openpyxl — 後述の注意点を参照
一括データ入出力pandas(read_excel、to_excel)
シートの簡易確認markitdown file.xlsx — シートごとに ## シート名 を表示。.xlsm も読み取り可。セル座標は出力されないため、編集計画には使用しないこと
モデル(数式と値の両方)の読み取り2回の load_workbook パス — 注意点を参照

openpyxl、pandas、markitdown はプリインストールされています。最初に pip install を実行せず、スクリプトを書いて直接インポートしてください。インポートが失敗した場合(または markitdown コマンドがない場合)のみ、pip install で不足しているパッケージをインストールしてください。

以下のスクリプトパスは、このスキルのディレクトリからの相対パスです。

すべての出力に対する要件

  • プロフェッショナルフォント(Arial、Times New Roman)を全体で使用すること。ユーザーが別途指定した場合を除く。
  • 数式エラーゼロ。 recalc.py が errors_found を報告する限り、決して納品しないでください。エラーがあなたの作業以前から存在すると考える場合、その証拠を示してください:data_only=True で元のファイルを読み込み、該当セルを確認してください。あなたが導入したエラーは、引き継いだエラーとまったく同じように見えます。
  • 数式を使用し、ハードコードされた結果を使用しないこと。 sheet['B10'] = '=SUM(B2:B9)' と記述し、Pythonで計算した合計値は書き込まないでください。シートは入力が変更されたときに再計算される必要があります。
  • ユーザーの仕様を文字通りに従うこと。 正確なタブ名、正確な列ヘッダー、ユーザーが指定した通りの数式。別の値を計算するリデザインは、どんなに洗練されていても失敗です。
  • すべての仮定とハードコードされた数値を、読者が確認できる場所に文書化すること — セルコメント、またはテーブルの末尾の隣接セル。実在する情報源がある場合は引用すること(出典:企業 10-K、2024年度、45ページ、収益注記、[SEC EDGAR URL]);数値がユーザーから提供された場合は、その旨を明確に記載すること。
  • ユーザーが記入するために作成するワークブックには、どのセルを編集すべきかを示す短い凡例と、期待される形式を示す1行の現実的な値のサンプル行を含めること。編集を依頼されたファイルにそのような行を追加しないでください。
  • 既存ファイルの編集:そのファイルの規則に完全に従うこと。 それらはここでのすべてのガイドラインに優先します。まず指定された入力セルを見つけてください — 異なるフォントカラー、塗りつぶし、または網掛けでマークされています — そこにのみ書き込み、既存の数式には一切触れないでください。

再計算(ファイルに数式が含まれる場合は必須)

openpyxl は数式を文字列として書き込みますが、キャッシュされた値はありません。再計算するまで、すべての数式セルはキャッシュ値を読み取るもの(pandas、load_workbook(data_only=True)、ほとんどのプレビューア)に対して None と読み戻されます。

python scripts/recalc.py output.xlsx [タイムアウト秒数]   # デフォルト 30

LibreOffice がすべての数式を計算し、ファイルはその場で上書きされ、JSON が出力されます:status(success | errors_found)、total_formulas、total_errors、およびエラーの種類ごとに最大100セルを名前付ける error_summary(locations_truncated は保留された数を示します — リストの長さではなく total_errors を信頼してください)。指定された内容を修正し、再度実行してください。status ではなく error キーを持つ JSON は、何も再計算されなかったことを意味し、その場合のみ非ゼロで終了します — errors_found は0で終了するため、クリーンな終了をクリーンなワークブックと見なさないでください。

緑色の再計算は、数式が評価されることを証明するだけであり、正しいことを証明するものではありません。 範囲の1オフセットエラーや間違った行への参照は、間違った数値を持つ、クリーンでエラーのないファイルを生成します。最初に2〜3個の数式を書き、期待する値を取得していることを確認してから、グリッドを構築してください。

別のファイルにリンクするワークブックは、openpyxl で再保存してから再計算すると、それらのリンクを失います。そのような数式は ='[1]Returns Analysis'!$B$2 と読み取られます — [1] はワークブックの外部参照リストへのインデックスであり、シートではなくディスク上の別ファイルを指定します。そのファイルはここにはほとんど存在しないため、セルのキャッシュ値だけがデータを保持しています。openpyxl は保存時にその値を削除します。その後、LibreOffice は参照を実際に解決する必要があり、失敗し、#NAME? を書き込み、すべてのリンクを削除します。recalc.py はその状態での実行を拒否します — 上書きする前に元のファイルからそれらのセルの値をコピーしてください(--force で上書きし、損失を受け入れます)。

検証を通過する数式の選択

LibreOffice は Excel よりも少ない関数しか実装しておらず、評価できない関数は文字通りの #NAME? として納品するファイルに焼き付けられます。

  • Excel-2007時代の関数を推奨 — SUMIFS、INDEX、MATCH、IFERROR、SUMPRODUCT — これらはプレフィックスを必要としません。
  • 2007年以降の6つの関数は、_xlfn. プレフィックスを付けると動作します。なぜなら、openpyxl は数式をXMLにそのまま書き込み、Excel は2007年以降の名前をプレフィックス付きで保存するからです(UIではプレフィックスは隠れます):_xlfn.TEXTJOIN、_xlfn.CONCAT、_xlfn.IFS、_xlfn.SWITCH、_xlfn.MAXIFS、_xlfn.MINIFS。プレフィックスなしで書くと、それぞれ #NAME? になります。
  • XLOOKUP、XMATCH、SORT、FILTER、UNIQUE、SEQUENCE は絶対に使用しないでください。 ランタイムの LibreOffice は、どのプレフィックスでもそれらを評価できません。新しいビルドでは評価できますが、これらはスピル配列関数であり、openpyxl で書き込まれたファイルにはスピルメタデータがないため、範囲の左上のセルだけに値が入ります — そして recalc.py は切り詰められた結果に対して total_errors: 0 を報告します。ルックアップには INDEX/MATCH を使用し、並べ替え、フィルター、重複除去はセルに書き込む前にPythonで行ってください。
  • LibreOffice が解析できなかった数式は小文字で書き戻されます — #NAME? の横にある素早い手がかりです。

openpyxl の注意点

  • モデルの読み取りには2回のロードが必要です。 data_only=True はキャッシュされた値を生成しますが、数式は失われます。デフォルトでは数式文字列が得られますが、値はありません。1回のパスで両方を取得することはできません。
  • data_only=True で保存すると破壊的です。 そのワークブックには数式が残っていないため、保存するとすべてのセルがリテラル値に置き換えられます — 永続的に。
  • openpyxl が書き込んだばかりのファイルに対して data_only=True を使用すると、すべてのセルで None が返ります — 最初に recalc.py を実行してください。(結果が "" の数式も None と読み戻されます。)
  • 結合セル:左上のアンカーセルにのみ書き込んでください。 範囲内の他のすべてのセルは MergedCell であり、.value は読み取り専用です。
  • .xlsm ファイルはマクロを失います。load_workbook に keep_vba=True を渡さない限り。
  • シート名にスペースが含まれる場合は、シート間参照で引用符で囲む必要があります:='Assumptions Inputs'!$B$5。引用符なしでは、#VALUE! と評価されます。

金融モデル

ユーザーが別途指定した場合、または既存ファイルが既に別の方法を使用している場合を除きます。

色: ハードコードされた入力値とシナリオレバーには青色テキスト(0,0,255)· 数式には黒色 · 別シートへのリンクには緑色(0,128,0)· 別ファイルへのリンクには赤色(255,0,0)· 主要な仮定とユーザーが記入すべきセルには黄色の塗りつぶし(255,255,0)。

数値: 通貨 $#,##0、ヘッダーに単位を明記(収益(百万ドル))· ゼロは - で表示(パーセンテージも含む、$#,##0;($#,##0);-)· 負数は括弧内 · パーセンテージ 0.0%、小数として保存(0.15 は 15.0% と表示;15 を保存すると 1500.0% と表示)· バリュエーション倍率 0.0x · 年はテキストとして("2024"、決して 2,024 ではない)。

構造: すべての仮定は独自のラベル付きセルに配置され、それを使用する数式から参照される(=B5*(1+$B$6)、決して =B5*1.05 ではない)· すべての予測期間にわたって数式を一貫させる(行中盤で単独編集されたセルが最も一般的な無言のエラーであるため)· ゼロになる可能性のある分母をガードする。

依存関係

openpyxl、pandas、markitdown(pip、プリインストール — インポートが失敗した場合またはコマンドがない場合のみインストール)· LibreOffice(soffice、サンドボックス環境向けに scripts/office/soffice.py によって自動設定済み)

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

academy-guide

Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.

algorithmic-art

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists

anthropics/template-skill

Replace with description of the skill and when Claude should use it.

brand-guidelines

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

canvas-design

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists

claude-api

|-

discernment-nudge

After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

docx

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.

frontend-design

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

internal-comms

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

pdf

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

pptx

Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill

slack-gif-creator

Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like

theme-factory

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

関連スキル