📊carta-reporting-excel
- プラグイン
- carta-cap-table
- ソース
- GitHub で見る ↗
説明
carta-reportingの内部サブスキルです。 CartaのレポートデータをブランドロゴつきのExcelファイルにエクスポートします。 次のような場合に使用: - ユーザーがExcel出力を要求した際に、carta-reportingまたはcarta-reporting-markdownから呼び出されるとき - メインスキルが「Generate Carta Excel —」で始まるメッセージを受信したとき(アーティファクトプロンプトバーのペイロード)
原文を表示
Internal subskill for carta-reporting. Exports Carta report data to a branded Excel file. Invoked by carta-reporting or carta-reporting-markdown when the user requests Excel output. Also the entry point when the main skill receives a message starting with "Generate Carta Excel —" (the artifact prompt bar payload).
ユースケース
- ✓ユーザーがExcel出力を要求したとき
- ✓carta-reportingからの呼び出し時
- ✓「Generate Carta Excel —」メッセージ受信時
本文(日本語訳)
Excel エクスポート
このスキルを呼び出す前にセッション内に必要なコンテキスト(事前に設定されている必要があります):
user_report_pk— キャッシュ済みレポートファイルの確認、およびファイルが存在しない場合の新しいダウンロードURLの取得に使用corporation_id—call_tool({"name": "reporting__get__download_url", ...})の呼び出しに使用- カラム設定 — アーティファクトプロンプトバーのペイロード(Claude Desktop)から解析されるか、
carta-reporting-markdownのカスタマイズチェックポイントで確認済みのもの(Claude Code) - 法人の正式名称・
as_of_date・ユーザーのフルネーム —excel_exporter.pyの--title、--as-of-date、--generated-by引数として使用
カラムのソース(Claude Desktop — アーティファクトプロンプトバー)
ユーザーがアーティファクトプロンプトバーのペイロードを貼り付けると、Generate Carta Excel — で始まる完全な命令として届きます:
Generate Carta Excel —
Corporation: Meetly, Inc. (ID: 7)
Columns:
Equity Grants: columns: Grant ID, Award Type, Exercise Price; sorted by: Grant Date desc
Vesting Schedule: columns: Grant ID, Vest Date, Shares Vested; totals: Shares Vested sum
Corporation: 行を使って、どの企業向けのエクスポートかを確認してください。
Columns: 以下のインデントされた各行が、1つのシートタブに対応します。
これは常に1つの Excel ファイルで、シートごとに1タブという構成です。
各シート行をパースし、per-sheet の sheets dict 形式を使って、すべてのシートを1回の実行で report_processor.py に渡してください。
追加の質問は不要です。
アーティファクトから取得したカラムリストが正式なものです。以前の会話の内容とマージしたり、上書きしたりしないでください。
セグメントフィールドを report_processor.py の設定にパースする方法:
| プロンプトバーのフィールド | report_processor.py の per-sheet キー |
|---|---|
columns: A, B, C |
"columns": ["A", "B", "C"] |
sorted by: Col asc |
"sort": [{"column": "Col", "direction": "asc"}] |
totals: Col sum, Col2 avg |
"aggregations": {"type": "summary", "columns": {"Col": "sum", "Col2": "avg"}} |
totals: は必ず aggregations に変換してください —
Excel の数式(=SUM(...)、=AVERAGE(...))が生成されるのはこの方法のみです。
aggregations を省略すると、出力の合計行はライブ数式ではなくAPIのハードコード値になります。
ユーザーがペイロードを貼り付けずに Excel を要求した場合は、次のように案内してください: 「アーティファクト下部の Excel エクスポート バーをクリックして選択し、コピー&ペーストしてください — そのカラム構成のままExcelを生成します。」
カラムのソース(Claude Code)
カスタマイズチェックポイント(carta-reporting-markdown で解決済み)で確認したカラムリストを使用してください。
エクスポートの実行
/tmp/carta_report_<user_report_pk>.json が利用可能かどうかを確認します(このセッションの user_report_pk を使用):
- ファイルが存在する場合 →
report_processor.pyに"local_file"として渡す - ファイルが存在しない場合 →
call_tool({"name": "reporting__get__download_url", "arguments": { user_report_pk, corporation_id }})を呼び出して新しい署名付きURLを取得し、代わりに"download_url"として渡す
データのサイズや複雑さに関わらず、常に report_processor.py → excel_exporter.py のパイプラインを通してください。
openpyxl やその他のライブラリを使って Excel ファイルを直接生成しないでください —
スクリプトが Carta ブランディング(ロゴ・ヘッダー・フォント・数値フォーマット)を処理しており、アドホックな実装ではこれらが欠落します。
データセットが小さい場合(例: 3行)や、シートを結合する必要がある場合も同様です。
シートを1つのタブに結合する場合は、report_processor.py の呼び出しで merge_sheets を使用してください。
sheets dict を使ってすべてのシートを1回の実行で渡し、excel_exporter.py にパイプしてください:
UV_PYTHON_DOWNLOADS=never uv run "$(find ~ -name "report_processor.py" -path "*/carta-reporting/scripts/*" 2>/dev/null | head -1)" <<'EOF' | \
UV_PYTHON_DOWNLOADS=never uv run "$(find ~ -name "excel_exporter.py" -path "*/carta-reporting-excel/scripts/*" 2>/dev/null | head -1)" \
--title "Securities Ledger Report" \
--as-of-date 2024-01-15 \
--generated-by "Jane Doe" \
--output ./{report-slug}.xlsx
{
"local_file": "<path or use download_url if file not ready>",
"sheets": {
"Equity Grants": {"columns": ["Grant ID", "Award Type", "Exercise Price"],
"aggregations": {"type": "summary", "columns": {"Exercise Price": "sum"}}},
"Vesting Schedule": {"columns": ["Grant ID", "Vest Date", "Shares Vested"],
"sort": [{"column": "Vest Date", "direction": "asc"}]}
}
}
EOF
スクリプトは成功時に出力ファイルの絶対パスを表示します。
クリック可能なリンクとして提示してください: computer://<絶対パス>
(例: computer:///Users/jane/meetly-equity-grants.xlsx)
ファイルの準備が完了したことをユーザーに伝え、次のアクションを提案してください:
- 別のレポートを実行する — 別の企業やレポートタイプで実行
- このエクスポートをカスタマイズする — フィルター・カラム・数式を調整
- 日付範囲やフィルターを変更する — 異なるパラメーターで再実行
Carta Excel フォーマット規則
| 要素 | 値 |
|---|---|
| ヘッダー背景色 | #c6ebf4 |
| ヘッダーフォント | Arial 12pt 太字、#2f3943 |
| ロゴ | <skill_base_dir>/assets/Carta_Logo.png、セル A2、120×50px |
| タイトル | セル B2、Arial 16pt 太字 |
| サブタイトル | セル B3、Arial 10pt、#666666 — "As of MMM d, yyyy • Generated with Claude AI by {user} at MMM d, yyyy h:mm:ss AM/PM TZ • Date format: MMM D, YYYY" |
| ヘッダー行 | 行5にオートフィルター付き、A6でペイン固定、データは行6から開始 |
カラム型 → 数値フォーマット:
money → $#,##0.00 · percentage → 0.00% · integer → #,##0 · date → mmm d, yyyy · decimal → #,##0.0000
カラム幅: 文字列・日付 → 35、数値型 → 18
原文(English)を表示
Excel Export
Context expected from the calling skill (must be in session before this skill is invoked):
user_report_pk— needed to check for the cached report file and to fetch a fresh download URL if the file is absentcorporation_id— needed forcall_tool({"name": "reporting__get__download_url", ...})- Column config — either parsed from the artifact prompt bar payload (Claude Desktop) or confirmed during the Customization Checkpoint in
carta-reporting-markdown(Claude Code) - Corporation legal name,
as_of_date, user full name — used as--title,--as-of-date,--generated-byargs toexcel_exporter.py
Column source (Claude Desktop — artifact prompt bar)
When the user pastes an artifact prompt bar payload, it arrives as a complete instruction starting with Generate Carta Excel —:
Generate Carta Excel —
Corporation: Meetly, Inc. (ID: 7)
Columns:
Equity Grants: columns: Grant ID, Award Type, Exercise Price; sorted by: Grant Date desc
Vesting Schedule: columns: Grant ID, Vest Date, Shares Vested; totals: Shares Vested sum
Use the Corporation: line to confirm which company the export is for. Each indented line under Columns: is one sheet tab. This is always one Excel file with one tab per sheet. Parse each sheet line and pass all sheets to report_processor.py in a single run using the per-sheet sheets dict format. No further questions needed.
The column list from the artifact is authoritative; do not merge with or override it from the earlier conversation.
Parsing segment fields into report_processor.py config:
| Prompt bar field | report_processor.py per-sheet key |
|---|---|
columns: A, B, C |
"columns": ["A", "B", "C"] |
sorted by: Col asc |
"sort": [{"column": "Col", "direction": "asc"}] |
totals: Col sum, Col2 avg |
"aggregations": {"type": "summary", "columns": {"Col": "sum", "Col2": "avg"}} |
totals: must become aggregations — this is the only way Excel formulas (=SUM(...), =AVERAGE(...)) are generated. If aggregations is omitted, any total rows in the output are hardcoded API values, not live formulas.
If the user asks for Excel without pasting a payload, ask: "Click the Excel export bar at the bottom of the artifact to select it, copy and paste it here — I'll generate the Excel with exactly those columns."
Column source (Claude Code)
Use the column list confirmed during the Customization Checkpoint (resolved in carta-reporting-markdown).
Running the export
Check if /tmp/carta_report_<user_report_pk>.json is available (use user_report_pk from this session):
- File ready → pass it as
"local_file"toreport_processor.py. - Not ready → call
call_tool({"name": "reporting__get__download_url", "arguments": { user_report_pk, corporation_id }})to get a fresh presigned URL and pass it as"download_url"instead.
Always pipe through report_processor.py → excel_exporter.py, regardless of data size or complexity. Never write Excel files directly with openpyxl or any other library — the scripts handle Carta branding (logo, header, fonts, number formats) that will be missing from any ad-hoc implementation. This applies even when the dataset is small (e.g. 3 rows) or when sheets need to be combined.
For combining sheets into one tab, use merge_sheets in the report_processor.py call.
Pass all sheets in one run using the sheets dict. Pipe into excel_exporter.py:
UV_PYTHON_DOWNLOADS=never uv run "$(find ~ -name "report_processor.py" -path "*/carta-reporting/scripts/*" 2>/dev/null | head -1)" <<'EOF' | \
UV_PYTHON_DOWNLOADS=never uv run "$(find ~ -name "excel_exporter.py" -path "*/carta-reporting-excel/scripts/*" 2>/dev/null | head -1)" \
--title "Securities Ledger Report" \
--as-of-date 2024-01-15 \
--generated-by "Jane Doe" \
--output ./{report-slug}.xlsx
{
"local_file": "<path or use download_url if file not ready>",
"sheets": {
"Equity Grants": {"columns": ["Grant ID", "Award Type", "Exercise Price"],
"aggregations": {"type": "summary", "columns": {"Exercise Price": "sum"}}},
"Vesting Schedule": {"columns": ["Grant ID", "Vest Date", "Shares Vested"],
"sort": [{"column": "Vest Date", "direction": "asc"}]}
}
}
EOF
The script prints the absolute output path on success. Present it as a clickable link: computer://<absolute-path> (e.g. computer:///Users/jane/meetly-equity-grants.xlsx). Tell the user their file is ready to open, then offer next steps:
- Run another report — for a different company or report type
- Customize this export — adjust filters, columns, or formulas
- Change the date range or filters — re-run with different parameters
Carta Excel Formatting Conventions
| Element | Value |
|---|---|
| Header background | #c6ebf4 |
| Header font | Arial 12pt bold, #2f3943 |
| Logo | <skill_base_dir>/assets/Carta_Logo.png, cell A2, 120×50px |
| Title | Cell B2, Arial 16pt bold |
| Subtitle | Cell B3, Arial 10pt, #666666 — "As of MMM d, yyyy • Generated with Claude AI by {user} at MMM d, yyyy h:mm:ss AM/PM TZ • Date format: MMM D, YYYY" |
| Header row | Row 5 with auto-filter; freeze panes at A6; data starts at row 6 |
Column type → number format: money → $#,##0.00 · percentage → 0.00% · integer → #,##0 · date → mmm d, yyyy · decimal → #,##0.0000
Column widths: string/date → 35, number types → 18.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。