# Excel Creation Fallback

Use shell_agent as fallback when execute_code_sandbox fails for Excel file operations

- Repository: https://github.com/HKUDS/AgentPilot (7784 stars)
- Category: Documents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add HKUDS/AgentPilot --skill excel-creation-fallback -g -a claude-code -y`
Codex: `npx skills add HKUDS/AgentPilot --skill excel-creation-fallback -g -a codex -y`
Cursor: `npx skills add HKUDS/AgentPilot --skill excel-creation-fallback -g -a cursor -y`
Gemini CLI: `npx skills add HKUDS/AgentPilot --skill excel-creation-fallback -g -a gemini-cli -y`

## Description

Use shell_agent as fallback when execute_code_sandbox fails for Excel file operations

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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:

```python
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).
```

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