Communitygithub.com

xlsx

Excelファイル(.xlsx、.xlsm、.xltx)の作成、編集、分析、変換を行います。数式、書式設定、財務モデル、マルチシートワークブック、表データのクリーンアップとエクスポートに最適です。

xlsx とは?

このスキルは、Excelワークブック(.xlsx、.xlsm、.xltx)を操作するための包括的なツールです。openpyxl、pandas、markitdown といったプリインストールされたライブラリを使用して、数式を含むワークブックの作成・編集、大量データの読み書き、シートの簡単なプレビュー、財務モデルの構築をサポートします。特に、セルに計算結果ではなく数式を書き込むこと、ファイル保存後の再計算の実行、LIBREOFFICEとの互換性を考慮した数式の選択など、ワークブックの品質を保証するための厳格なルールが定義されています。また、既存ファイルの編集時には元の書式や規約を尊重し、数式エラーがゼロの状態で納品することを求めます。このスキルはClaude CodeやCursorなどのAIエージェントで利用でき、基本的なデータ操作から複雑な財務モデリングまで、幅広いExcel関連タスクを自動化します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/xlsx

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

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

ドキュメント

XLSXの作成、編集、分析

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

openpyxl、pandas、markitdown はプリインストールされています — uv pip install を先に実行せず、スクリプトを書いて直接インポートしてください。インポートが失敗した場合(または markitdown コマンドが見つからない場合)のみ、uv 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、ヘッダーに単位を記載(収益 ($mm)) · ゼロは - と表示(パーセンテージも含む、$#,##0;($#,##0);-) · 負の数は括弧内 · パーセンテージは 0.0%、分数として保存(0.15 は 15.0% と表示、15 を保存すると 1500.0% と表示) · バリュエーション倍率は 0.0x · 年はテキストとして("2024"、決して 2,024 ではない)。

構造: すべての前提条件をそれ自身のラベル付きセルに配置し、それを使用する数式から参照(=B5*(1+$B$6)、決して =B5*1.05 ではない) · すべての予測期間にわたって数式を一貫させる。なぜなら、行の途中の1つの編集されたセルが最も一般的なサイレントエラーだからです · ゼロになり得る分母をガードする。

依存関係

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


このスキルは Anthropic によって作成および管理されています。フロントマターメタデータを除き、そのままベンダー提供されています。利用条件については LICENSE.txt を参照してください。

Individual skills in this repo

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

adaptyv

How to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

alphagenome

Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), score variants or scan windows on demand with the AlphaGenome model for human and mouse (variant scoring, in silico mutagenesis, REF-versus-ALT track prediction), and build Atlas website deep links. Use when the user mentions AlphaGenome, AlphaGenome Atlas, AVI or AlphaGenome Variant Impact, DeepMind variant effect prediction, or wants to prioritise or mechanistically interpret non-coding, regulatory, splicing, enhancer, promoter, or chromatin-accessibility effects of SNVs from a VCF, credible set, or region. Research use only; not a clinical tool.

analytical-method-validation

Plan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include

anndata

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

arbor

Autonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g.

arboreto

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

autoskill

Observe the user

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

bgpt-paper-search

Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server. Returns 25+ fields per paper including methods, results, sample sizes, quality scores, and conclusions. Use for literature reviews, evidence synthesis, and finding experimental details not available in abstracts alone.

bids

>

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.

bulk-rnaseq

End-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA enrichment (pathway-enrichment), and publication figures (scientific-visualization). Use whenever the user has bulk RNA-seq reads or quant output and wants a complete, reproducible differential-expression workflow — e.g.

cellxgene-census

Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.

cirq

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

citation-management

Comprehensive citation management for academic research. Search OpenAlex, PubMed, and Google Scholar for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

clinical-reports

Create safety-bounded draft structures and run local deterministic checks for clinical case, diagnostic, trial, safety, and aggregate research reports. Use only with synthetic, de-identified, or aggregate inputs and verified source-fact manifests; every output requires qualified review.

関連スキル