• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLSkills

xlsx

プラグイン
document-skills
ライセンス
Proprietary. LICENSE.txt has complete terms
ソース
GitHub で見る ↗
説明

このスキルを使用する場合: スプレッドシートファイルが主な入出力である任意のタスク時に使用してください。これには、ユーザーが以下を希望する場合が含まれます: - **既存ファイルの操作**: .xlsx、.xlsm、.xltx、.csv、.tsvファイルを開く、読み込む、編集する、または修正する(列の追加、計算式の実行、書式設定、グラフ作成、散らかったデータの整理など) - **新規作成**: ゼロから、または他のデータソースからスプレッドシートを新規作成する - **形式の変換**: 異なる表形式ファイル間での変換 **特に次の場合は使用してください:** - ユーザーがスプレッドシートファイルを名前またはパスで参照している(「ダウンロードフォルダのエクセルファイル」のようなカジュアルな言及でも)場合で、何かの処理や成果物を求めている - 不正な形式のデータ(形式が整わない行、不適切なヘッダー、不要なデータなど)を持つ散らかった表形式ファイルを、適切なスプレッドシートに整理・再構成する **重要な制限:** 主な成果物がWord文書、HTMLレポート、独立したPythonスクリプト、データベースパイプライン、またはGoogle Sheets APIの統合である場合は、表形式データが関わっていてもこのスキルは使用しないでください。最終成果物は必ずスプレッドシートファイルである必要があります。

原文を表示

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

ユースケース
  • 既存のスプレッドシートファイルを開く、読み込む、編集する
  • ゼロから新しいスプレッドシートを作成する
  • 異なる表形式ファイル間で形式を変換する
  • 散らかったデータを整理・再構成する
  • スプレッドシートに列追加、計算式実行、書式設定する
本文(日本語訳)

XLSX ファイルの作成、編集、分析

作業 方法
作成または編集(数式・書式を含む) openpyxl — 下記の注意点を参照
大量データの出入力 pandas(read_excel、to_excel)
シートの内容をさっと確認 markitdown file.xlsx — シートごとに ## シート名 で表示;.xlsm にも対応。セルの座標表示がないため、この出力から編集内容を決めないこと
モデルを読み込む(数式と計算結果の両方) load_workbook を 2 回実行 — 下記の注意点を参照

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 は何も再計算されなかった意味で、その場合のみ 0 以外で終了します — errors_found は 0 で終了するため、クリーンな終了をクリーンなワークブックとして扱わないでください。

グリーン再計算は数式が評価されることを証明するものであり、正しいことを証明するものではない。範囲が 1 ずれていたり、別の行を参照していたりすると、エラーのないクリーンなファイルが得られても、数値が間違っています。最初に 2 ~ 3 個の数式を書いて、期待する値をプルしていることを確認してから、グリッドを完成させてください。

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

検証を生き残る数式を選ぶ

LibreOffice は Excel より少ない関数を実装しており、評価できない 1 つは配信ファイルに #NAME? として固定化されます。

  • Excel 2007 時代の関数を優先 — SUMIFS、INDEX、MATCH、IFERROR、SUMPRODUCT — プレフィックス不要です。

  • 6 つのポスト 2007 関数は動作しますが、_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 は保存時に破壊的。そのワークブックには数式が残っていないため、保存するとすべてが文字列に置き換わります — 永久的に。

  • data_only=True を openpyxl が書き込んだばかりのファイルで実行すると、すべての場所で None が返される — 先に recalc.py を実行してください。(結果が "" の数式も None として読み返されます。)

  • 結合セル:左上のアンカーのみに書き込む。範囲内の他のすべてのセルは、.value が読み取り専用の MergedCell です。

  • .xlsm はマクロを失う load_workbook に keep_vba=True を渡さない限り。

  • スペースを含むシート名は、クロスシート参照で引用符が必要:='Assumptions Inputs'!$B$5。引用符なしだと、#VALUE! として評価されます。

財務モデル

ユーザーが別の指定をした場合、または既存ファイルが既に別のパターンを採用している場合を除きます。

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

数値: 通貨は $#,##0、単位を見出しに記載(Revenue ($mm))· ゼロは - でレンダリング(パーセンテージを含む $#,##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 で自動構成)

原文(English)を表示

XLSX creation, editing, and analysis

Task Approach
Create or edit with formulas/formatting openpyxl — see gotchas below
Bulk data in or out pandas (read_excel, to_excel)
Quick look at a sheet markitdown file.xlsx — ## SheetName per sheet; reads .xlsm too. No cell coordinates, so don't plan edits from it
Read a model (formulas and values) two load_workbook passes — see gotchas

openpyxl, pandas, and markitdown are preinstalled — do not run pip install first; write the script and import directly. Only if an import fails (or the markitdown command is missing): pip install the missing package.

Script paths below are relative to this skill's directory.

Requirements for every output

  • Professional font (Arial, Times New Roman) throughout, unless the user says otherwise.
  • Zero formula errors. Never ship while recalc.py reports errors_found. If you think an error predates you, prove it: load the original with data_only=True and look at that cell. An error you introduced looks exactly like one you inherited.
  • Use formulas, never hardcoded results. Write sheet['B10'] = '=SUM(B2:B9)', not the Python-computed total. The sheet must recalculate when its inputs change.
  • Follow the user's spec literally. Exact tab names, exact column headers, and the formula they spelled out. A redesign that computes something else fails, however elegant.
  • Document every assumption and hardcoded number where the reader will see it — a cell comment, or an adjacent cell at a table's end. Cite a real source when one exists (Source: Company 10-K, FY2024, Page 45, Revenue Note, [SEC EDGAR URL]); when the number came from the user, say so plainly.
  • A workbook you create for someone to fill in needs a short legend naming which cells to edit, and one example row of realistic values showing the expected format. Never add such a row to a file you were asked to edit.
  • Editing an existing file: match its conventions exactly. They override every guideline here. Find its designated input cells first — a distinct font color, fill, or shading marks them — write only there, and leave every existing formula untouched.

Recalculate (mandatory whenever the file contains formulas)

openpyxl writes formulas as strings with no cached values. Until you recalculate, every formula cell reads back as None to anything reading cached values — pandas, load_workbook(data_only=True), and most previewers.

python scripts/recalc.py output.xlsx [timeout_seconds]   # default 30

LibreOffice computes every formula, the file is rewritten in place, and you get JSON: status (success | errors_found), total_formulas, total_errors, and an error_summary naming up to 100 cells per error type (locations_truncated says how many it withheld — trust total_errors, not the length of the list). Fix what it names and run it again. JSON with an error key instead of a status means nothing was recalculated, and only that case exits non-zero — errors_found exits 0, so never treat a clean exit as a clean workbook.

A green recalc proves your formulas evaluate, not that they are right. An off-by-one range or a reference to the wrong row yields a clean, error-free file with wrong numbers. Write 2–3 formulas first and check they pull the values you expect, before building out a grid.

A workbook that links to another file loses those links if you re-save it with openpyxl and then recalculate. Such a formula reads ='[1]Returns Analysis'!$B$2 — the [1] is an index into the workbook's external-reference list, naming a separate file on disk, not a sheet. That file is rarely present here, so the cell's cached value is the only thing holding its data. openpyxl strips that value on save; LibreOffice then has to resolve the reference for real, fails, writes #NAME?, and deletes every link. recalc.py refuses to run in that state — copy those cells' values out of the original before you save over them (--force overrides, and accepts the loss).

Choosing formulas that survive verification

LibreOffice implements fewer functions than Excel, and one it cannot evaluate becomes a literal #NAME? baked into the file you deliver.

  • Prefer Excel-2007-era functions — SUMIFS, INDEX, MATCH, IFERROR, SUMPRODUCT — which need no prefix.
  • Six post-2007 functions work, but only with an _xlfn. prefix, because openpyxl writes your formula into the XML verbatim and Excel stores post-2007 names prefixed (its UI hides the prefix): _xlfn.TEXTJOIN, _xlfn.CONCAT, _xlfn.IFS, _xlfn.SWITCH, _xlfn.MAXIFS, _xlfn.MINIFS. Written bare, each yields #NAME?.
  • Never use XLOOKUP, XMATCH, SORT, FILTER, UNIQUE, or SEQUENCE. The runtime's LibreOffice cannot evaluate them under any prefix. Newer builds do evaluate them, but they are spilling array functions and an openpyxl-written file has no spill metadata, so only the top-left cell of the range gets a value — and recalc.py reports total_errors: 0 on the truncated result. Use INDEX/MATCH for lookups, and sort, filter, and de-duplicate in Python before writing the cells.
  • A formula LibreOffice could not parse is written back lowercased — a quick tell beside a #NAME?.

openpyxl gotchas

  • Reading a model takes two loads. data_only=True yields cached values with the formulas gone; the default yields formula strings with no values. One pass cannot give you both.
  • data_only=True is destructive if you save. That workbook has no formulas left, so saving replaces every one with a literal — permanently.
  • data_only=True on a file openpyxl just wrote returns None everywhere — run recalc.py first. (A formula whose result is "" also reads back as None.)
  • Merged cells: write the top-left anchor only. Every other cell in the range is a MergedCell whose .value is read-only.
  • .xlsm loses its macros unless you pass keep_vba=True to load_workbook.
  • A sheet name containing a space must be quoted in a cross-sheet reference: ='Assumptions Inputs'!$B$5. Unquoted, it evaluates to #VALUE!.

Financial models

Unless the user says otherwise, or the existing file already does something else.

Color: blue text (0,0,255) for hardcoded inputs and scenario levers · black for formulas · green (0,128,0) for links to another sheet · red (255,0,0) for links to another file · yellow fill (255,255,0) for key assumptions and cells the user should fill in.

Numbers: currency $#,##0, with the unit named in the header (Revenue ($mm)) · zeros render as -, including in percentages ($#,##0;($#,##0);-) · negatives in parentheses · percentages 0.0%, stored as fractions (0.15 renders 15.0%; storing 15 renders 1500.0%) · valuation multiples 0.0x · years as text ("2024", never 2,024).

Structure: every assumption in its own labeled cell, referenced by the formulas that use it (=B5*(1+$B$6), never =B5*1.05) · formulas consistent across every projection period, since a lone edited cell mid-row is the commonest silent error · guard denominators that can be zero.

Dependencies

openpyxl, pandas, markitdown (pip, preinstalled — install only if an import fails or the command is missing) · LibreOffice (soffice, auto-configured for sandboxed environments via scripts/office/soffice.py)

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。