本文へスキップ
Skillpedia
PDF・Word・スライド7.8k · #12872

excel-creation-fallback

できること

このスキルは、openpyxlを使って.xlsxファイルを作る方法と、コード実行環境がそれを実行できないときの対処を説明します。特定の列、書式、集計を備えたスプレッドシートが必要な人向けです。

使う場面

  • ✓サンドボックスで、openpyxlのインポートエラーが出て失敗するとき。
  • ✓見出し、書式、合計を備えたスプレッドシートが必要なとき。
  • ✓同じスプレッドシートの作業で、サンドボックスの保存が何度も失敗するとき。

スキルのリンク

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/excel-creation-fallback/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/excel-creation-fallback/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“日付、指標、値の列があり、見出しが太字で、合計行のあるExcelファイルを作ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIは、まずサンドボックスでopenpyxlを使ってファイルを作ろうとします。失敗したら、明確な説明をシェルのヘルパーに渡し、そのヘルパーが必要なライブラリをインストールし、ファイルを保存します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Excel File Creation Fallback

When execute_code_sandbox fails for openpyxl or Excel operations, delegate to shell_agent which can autonomously handle dependency and environment issues.

When to Use

  • execute_code_sandbox fails with import errors for openpyxl or related libraries
  • The sandbox environment lacks required dependencies
  • You need to create or modify Excel files with complex requirements
  • Repeated sandbox execution failures for file I/O operations

Steps

Step 1: Attempt with execute_code_sandbox first

Try creating the Excel file using Python's openpyxl library in the code sandbox:

from openpyxl import Workbook

wb = Workbook()
ws = wb.active
ws.append(['Column1', 'Column2', 'Column3'])
wb.save('output.xlsx')

Step 2: If it fails, switch to shell_agent

Delegate the task to shell_agent with a clear, comprehensive task description:

Create an Excel file named 'output.xlsx' with the following structure:
- Sheet 1: Data with columns [Date, Metric, Value]
- Include sample data rows with realistic values
- Apply basic formatting (bold headers, cell borders)
- Add a summary section with totals or averages
- Save the file in the current directory

Step 3: Let shell_agent handle the environment

The shell_agent will:

  • Decide whether to use Python or Bash
  • Install dependencies if needed (e.g., pip install openpyxl)
  • Write and execute the code
  • Automatically retry and fix errors (up to several rounds)
  • Confirm the file was created successfully

Example Task Descriptions

Basic Excel file:

Create an Excel file named 'sales_report.xlsx' with headers: Date, Product, Quantity, Price, Total. Add 10 sample rows of data and a formula column for Total (Quantity * Price).

Complex Excel with formatting:

Create an Excel file with multiple sheets:
- Sheet 'Summary': Key metrics and totals
- Sheet 'Details': Full transaction data with columns [ID, Date, Customer, Amount, Status]
- Apply conditional formatting to highlight amounts over 1000
- Add borders to all cells and bold headers

Tiered pricing structure:

Create an Excel file with a tiered pricing table:
- Column A: Quantity thresholds (0, 100, 500, 1000)
- Column B: Unit price at each tier
- Column C: Discount percentage (e.g., 15% discount over 1000 units)
- Include a financial summary section with projections

Why This Pattern Works

shell_agent has several advantages over execute_code_sandbox for file creation tasks:

Feature execute_code_sandbox shell_agent
Dependency installation Manual/preset only Autonomous
Error recovery Returns error Auto-retries and fixes
Tool selection Python only Python, Bash, or other
Filesystem access Sandbox-limited Full workspace access
Verification None Can verify file creation

Troubleshooting

If shell_agent also struggles:

  1. Be more specific - Include exact column names, data types, and formatting requirements
  2. Provide sample data - Include example rows to clarify expected output
  3. Break it down - For complex files, request creation in stages
  4. Check permissions - Ensure the target directory is writable

Alternative Approaches

If shell_agent is unavailable or unsuitable:

  • Use run_shell with explicit commands (if you know the exact syntax)
  • Check for alternative libraries (xlsxwriter, pandas with openpyxl engine)
  • Use CSV as intermediate format, then convert to Excel
よくある質問

openpyxlとは何ですか?

Excelファイルを作成し編集するPythonライブラリです。

不足しているパッケージは誰がインストールしますか?

シェルのヘルパーは、必要ならopenpyxlなどの依存関係をインストールできます。

依頼には何を含めるべきですか?

シート、列、サンプルの行、書式、保存先の明確な説明です。

詳細

作者による元の説明

Use shell_agent as fallback when execute_code_sandbox fails for Excel file operations

repo: HKUDS/AgentPilot

人気

GitHubのスター
7.8k
ランキング
#12872
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル