jpskill.com
📄 ドキュメント コミュニティ

excel-analysis

Excelファイルや表形式のデータを分析し、ピボットテーブルの作成やグラフの生成、データ分析などを実行して、ビジネス上の課題解決や意思決定を支援するSkill。

📜 元の英語説明(参考)

Analyze Excel spreadsheets, create pivot tables, generate charts, and perform data analysis. Use when analyzing Excel files, spreadsheets, tabular data, or .xlsx files.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Excelファイルや表形式のデータを分析し、ピボットテーブルの作成やグラフの生成、データ分析などを実行して、ビジネス上の課題解決や意思決定を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o excel-analysis.zip https://jpskill.com/download/18402.zip && unzip -o excel-analysis.zip && rm excel-analysis.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18402.zip -OutFile "$d\excel-analysis.zip"; Expand-Archive "$d\excel-analysis.zip" -DestinationPath $d -Force; ri "$d\excel-analysis.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して excel-analysis.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → excel-analysis フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Excel Analysis

クイックスタート

pandas を使用して Excel ファイルを読み込む:

import pandas as pd

# Excel ファイルを読み込む
df = pd.read_excel("data.xlsx", sheet_name="Sheet1")

# 最初の数行を表示する
print(df.head())

# 基本的な統計
print(df.describe())

複数のシートの読み込み

ワークブック内のすべてのシートを処理する:

import pandas as pd

# すべてのシートを読み込む
excel_file = pd.ExcelFile("workbook.xlsx")

for sheet_name in excel_file.sheet_names:
    df = pd.read_excel(excel_file, sheet_name=sheet_name)
    print(f"\n{sheet_name}:")
    print(df.head())

データ分析

一般的な分析タスクを実行する:

import pandas as pd

df = pd.read_excel("sales.xlsx")

# グループ化と集計
sales_by_region = df.groupby("region")["sales"].sum()
print(sales_by_region)

# データをフィルタリング
high_sales = df[df["sales"] > 10000]

# メトリクスを計算
df["profit_margin"] = (df["revenue"] - df["cost"]) / df["revenue"]

# 列でソート
df_sorted = df.sort_values("sales", ascending=False)

Excel ファイルの作成

書式設定を使用して Excel にデータを書き込む:

import pandas as pd

df = pd.DataFrame({
    "Product": ["A", "B", "C"],
    "Sales": [100, 200, 150],
    "Profit": [20, 40, 30]
})

# Excel に書き込む
writer = pd.ExcelWriter("output.xlsx", engine="openpyxl")
df.to_excel(writer, sheet_name="Sales", index=False)

# 書式設定のためにワークシートを取得
worksheet = writer.sheets["Sales"]

# 列幅を自動調整
for column in worksheet.columns:
    max_length = 0
    column_letter = column[0].column_letter
    for cell in column:
        if len(str(cell.value)) > max_length:
            max_length = len(str(cell.value))
    worksheet.column_dimensions[column_letter].width = max_length + 2

writer.close()

ピボットテーブル

プログラムでピボットテーブルを作成する:

import pandas as pd

df = pd.read_excel("sales_data.xlsx")

# ピボットテーブルを作成
pivot = pd.pivot_table(
    df,
    values="sales",
    index="region",
    columns="product",
    aggfunc="sum",
    fill_value=0
)

print(pivot)

# ピボットテーブルを保存
pivot.to_excel("pivot_report.xlsx")

チャートと可視化

Excel データからチャートを生成する:

import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_excel("data.xlsx")

# 棒グラフを作成
df.plot(x="category", y="value", kind="bar")
plt.title("Sales by Category")
plt.xlabel("Category")
plt.ylabel("Sales")
plt.tight_layout()
plt.savefig("chart.png")

# 円グラフを作成
df.set_index("category")["value"].plot(kind="pie", autopct="%1.1f%%")
plt.title("Market Share")
plt.ylabel("")
plt.savefig("pie_chart.png")

データクレンジング

Excel データをクリーンアップして準備する:

import pandas as pd

df = pd.read_excel("messy_data.xlsx")

# 重複を削除
df = df.drop_duplicates()

# 欠損値を処理
df = df.fillna(0)  # または df.dropna()

# 空白を削除
df["name"] = df["name"].str.strip()

# データ型を変換
df["date"] = pd.to_datetime(df["date"])
df["amount"] = pd.to_numeric(df["amount"], errors="coerce")

# クリーンアップされたデータを保存
df.to_excel("cleaned_data.xlsx", index=False)

マージと結合

複数の Excel ファイルを結合する:

import pandas as pd

# 複数のファイルを読み込む
df1 = pd.read_excel("sales_q1.xlsx")
df2 = pd.read_excel("sales_q2.xlsx")

# 垂直方向に連結
combined = pd.concat([df1, df2], ignore_index=True)

# 共通の列でマージ
customers = pd.read_excel("customers.xlsx")
sales = pd.read_excel("sales.xlsx")

merged = pd.merge(sales, customers, on="customer_id", how="left")

merged.to_excel("merged_data.xlsx", index=False)

高度な書式設定

条件付き書式とスタイルを適用する:

import pandas as pd
from openpyxl import load_workbook
from openpyxl.styles import PatternFill, Font

# Excel ファイルを作成
df = pd.DataFrame({
    "Product": ["A", "B", "C"],
    "Sales": [100, 200, 150]
})

df.to_excel("formatted.xlsx", index=False)

# 書式設定のためにワークブックをロード
wb = load_workbook("formatted.xlsx")
ws = wb.active

# 条件付き書式を適用
red_fill = PatternFill(start_color="FF0000", end_color="FF0000", fill_type="solid")
green_fill = PatternFill(start_color="00FF00", end_color="00FF00", fill_type="solid")

for row in range(2, len(df) + 2):
    cell = ws[f"B{row}"]
    if cell.value < 150:
        cell.fill = red_fill
    else:
        cell.fill = green_fill

# ヘッダーを太字にする
for cell in ws[1]:
    cell.font = Font(bold=True)

wb.save("formatted.xlsx")

パフォーマンスのヒント

  • 特定の列のみを読み込むには、read_excelusecols と共に使用する
  • 非常に大きなファイルの場合は chunksize を使用する
  • ファイルの種類に基づいて engine='openpyxl' または engine='xlrd' の使用を検討する
  • より高速な読み込みのために dtype パラメータを使用して列の型を指定する

利用可能なパッケージ

  • pandas - データ分析と操作 (主要)
  • openpyxl - Excel ファイルの作成と書式設定
  • xlrd - 古い .xls ファイルの読み込み
  • xlsxwriter - 高度な Excel 書き込み機能
  • matplotlib - チャートの生成
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Excel Analysis

Quick start

Read Excel files with pandas:

import pandas as pd

# Read Excel file
df = pd.read_excel("data.xlsx", sheet_name="Sheet1")

# Display first few rows
print(df.head())

# Basic statistics
print(df.describe())

Reading multiple sheets

Process all sheets in a workbook:

import pandas as pd

# Read all sheets
excel_file = pd.ExcelFile("workbook.xlsx")

for sheet_name in excel_file.sheet_names:
    df = pd.read_excel(excel_file, sheet_name=sheet_name)
    print(f"\n{sheet_name}:")
    print(df.head())

Data analysis

Perform common analysis tasks:

import pandas as pd

df = pd.read_excel("sales.xlsx")

# Group by and aggregate
sales_by_region = df.groupby("region")["sales"].sum()
print(sales_by_region)

# Filter data
high_sales = df[df["sales"] > 10000]

# Calculate metrics
df["profit_margin"] = (df["revenue"] - df["cost"]) / df["revenue"]

# Sort by column
df_sorted = df.sort_values("sales", ascending=False)

Creating Excel files

Write data to Excel with formatting:

import pandas as pd

df = pd.DataFrame({
    "Product": ["A", "B", "C"],
    "Sales": [100, 200, 150],
    "Profit": [20, 40, 30]
})

# Write to Excel
writer = pd.ExcelWriter("output.xlsx", engine="openpyxl")
df.to_excel(writer, sheet_name="Sales", index=False)

# Get worksheet for formatting
worksheet = writer.sheets["Sales"]

# Auto-adjust column widths
for column in worksheet.columns:
    max_length = 0
    column_letter = column[0].column_letter
    for cell in column:
        if len(str(cell.value)) > max_length:
            max_length = len(str(cell.value))
    worksheet.column_dimensions[column_letter].width = max_length + 2

writer.close()

Pivot tables

Create pivot tables programmatically:

import pandas as pd

df = pd.read_excel("sales_data.xlsx")

# Create pivot table
pivot = pd.pivot_table(
    df,
    values="sales",
    index="region",
    columns="product",
    aggfunc="sum",
    fill_value=0
)

print(pivot)

# Save pivot table
pivot.to_excel("pivot_report.xlsx")

Charts and visualization

Generate charts from Excel data:

import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_excel("data.xlsx")

# Create bar chart
df.plot(x="category", y="value", kind="bar")
plt.title("Sales by Category")
plt.xlabel("Category")
plt.ylabel("Sales")
plt.tight_layout()
plt.savefig("chart.png")

# Create pie chart
df.set_index("category")["value"].plot(kind="pie", autopct="%1.1f%%")
plt.title("Market Share")
plt.ylabel("")
plt.savefig("pie_chart.png")

Data cleaning

Clean and prepare Excel data:

import pandas as pd

df = pd.read_excel("messy_data.xlsx")

# Remove duplicates
df = df.drop_duplicates()

# Handle missing values
df = df.fillna(0)  # or df.dropna()

# Remove whitespace
df["name"] = df["name"].str.strip()

# Convert data types
df["date"] = pd.to_datetime(df["date"])
df["amount"] = pd.to_numeric(df["amount"], errors="coerce")

# Save cleaned data
df.to_excel("cleaned_data.xlsx", index=False)

Merging and joining

Combine multiple Excel files:

import pandas as pd

# Read multiple files
df1 = pd.read_excel("sales_q1.xlsx")
df2 = pd.read_excel("sales_q2.xlsx")

# Concatenate vertically
combined = pd.concat([df1, df2], ignore_index=True)

# Merge on common column
customers = pd.read_excel("customers.xlsx")
sales = pd.read_excel("sales.xlsx")

merged = pd.merge(sales, customers, on="customer_id", how="left")

merged.to_excel("merged_data.xlsx", index=False)

Advanced formatting

Apply conditional formatting and styles:

import pandas as pd
from openpyxl import load_workbook
from openpyxl.styles import PatternFill, Font

# Create Excel file
df = pd.DataFrame({
    "Product": ["A", "B", "C"],
    "Sales": [100, 200, 150]
})

df.to_excel("formatted.xlsx", index=False)

# Load workbook for formatting
wb = load_workbook("formatted.xlsx")
ws = wb.active

# Apply conditional formatting
red_fill = PatternFill(start_color="FF0000", end_color="FF0000", fill_type="solid")
green_fill = PatternFill(start_color="00FF00", end_color="00FF00", fill_type="solid")

for row in range(2, len(df) + 2):
    cell = ws[f"B{row}"]
    if cell.value < 150:
        cell.fill = red_fill
    else:
        cell.fill = green_fill

# Bold headers
for cell in ws[1]:
    cell.font = Font(bold=True)

wb.save("formatted.xlsx")

Performance tips

  • Use read_excel with usecols to read specific columns only
  • Use chunksize for very large files
  • Consider using engine='openpyxl' or engine='xlrd' based on file type
  • Use dtype parameter to specify column types for faster reading

Available packages

  • pandas - Data analysis and manipulation (primary)
  • openpyxl - Excel file creation and formatting
  • xlrd - Reading older .xls files
  • xlsxwriter - Advanced Excel writing capabilities
  • matplotlib - Chart generation