openpyxl-sandbox-workaround
O que ela faz
Esta skill é uma alternativa para tarefas de planilha em que o sandbox de código falha. Ela executa o código openpyxl diretamente pelo shell. É para pessoas que precisam criar um arquivo Excel quando o sandbox habitual falha.
Quando usar
- ✓Quando o sandbox de código falha repetidamente em uma tarefa com openpyxl ou planilha.
- ✓Quando os erros mencionam a criação da pasta de trabalho, a escrita de células ou o salvamento.
- ✓Quando preciso de um trabalho de planilha em várias etapas que carrega um arquivo existente e grava novos dados.
Link da skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/openpyxl-sandbox-workaround/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“O sandbox continua falhando ao montar minha planilha. Por favor, execute o mesmo código pelo shell e salve o arquivo.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A IA escreve um script Python embutido em um heredoc do shell, cria ou carrega a pasta de trabalho, adiciona os dados, salva o arquivo e imprime uma mensagem de confirmação.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Openpyxl Sandbox Workaround
When to Use
Use this pattern when execute_code_sandbox repeatedly fails for openpyxl or spreadsheet manipulation tasks. The sandbox environment may have compatibility issues with certain openpyxl operations, but running Python directly via run_shell often succeeds.
Common Failure Indicators
execute_code_sandboxreturns errors related to openpyxl imports or operations- Multiple retry attempts fail with similar errors
- Errors mention workbook creation, cell writing, or file saving issues
The Workaround Pattern
Instead of using execute_code_sandbox, use run_shell with an inline Python script:
python3 << 'EOF'
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
# Your openpyxl code here
wb = Workbook()
ws = wb.active
ws.title = "Sheet1"
# Add data
ws['A1'] = 'Header'
ws['B1'] = 'Value'
# Save file
wb.save('output.xlsx')
print('File created successfully')
EOF
Multi-Step Spreadsheet Tasks
For complex operations involving multiple files or data processing:
python3 << 'EOF'
from openpyxl import Workbook, load_workbook
import os
# Load existing workbook if needed
if os.path.exists('input.xlsx'):
wb = load_workbook('input.xlsx')
ws = wb.active
# Process data...
# Create new workbook
wb = Workbook()
ws = wb.active
# Add data with proper formatting
for row_idx, row_data in enumerate(data, start=1):
for col_idx, value in enumerate(row_data, start=1):
ws.cell(row=row_idx, column=col_idx, value=value)
# Auto-adjust column widths
for column in ws.columns:
max_length = 0
column_letter = get_column_letter(column[0].column)
for cell in column:
try:
if len(str(cell.value)) > max_length:
max_length = len(str(cell.value))
except:
pass
adjusted_width = min(max_length + 2, 50)
ws.column_dimensions[column_letter].width = adjusted_width
wb.save('output.xlsx')
EOF
Best Practices
- Use heredoc syntax: The
<< 'EOF'pattern prevents variable expansion issues - Print success messages: Always include print statements to confirm completion
- Handle file paths: Use absolute paths or ensure you're in the correct working directory
- Validate output: After creation, verify the file exists and has expected content
- Error handling: Add try/except blocks for robustness in complex scripts
Verification Step
After running the script, verify the file was created:
ls -la *.xlsx
Or check file details:
python3 << 'EOF'
from openpyxl import load_workbook
wb = load_workbook('output.xlsx')
print(f"Sheets: {wb.sheetnames}")
print(f"Active sheet: {wb.active.title}")
EOF
When to Fall Back to This Pattern
- First
execute_code_sandboxattempt fails with openpyxl errors - Error persists after 1-2 retries
- Task is time-sensitive and needs a reliable solution
- The operation is straightforward file creation/modification
Limitations
- Output is limited to stdout/stderr (no direct artifact download from run_shell)
- Files are created in the current working directory
- More verbose than execute_code_sandbox for simple operations
Perguntas frequentes
Por que essa rota ajuda?
O guia diz que o sandbox pode ter problemas de compatibilidade que a execução direta do Python pelo shell evita.
Ela consegue abrir uma pasta de trabalho existente?
Sim. O exemplo carrega uma pasta de trabalho de entrada, se ela existir, antes de criar o conteúdo novo.
Como saber se deu certo?
O script imprime uma mensagem de sucesso, e o arquivo salvo pode ser conferido.
Detalhes
Descrição original do autor
Use run_shell with inline Python as a fallback when execute_code_sandbox fails for openpyxl/spreadsheet operations
repo: HKUDS/AgentPilot
Popularidade
- Estrelas no GitHub
- 7,8 mil
- Posição no ranking
- #12902
- Licença
- MIT
- Atualizada em
- 01/11/2026
Comentários
- …
Mais skills deste repositório
agentpilot
7,8 milAjuda seu agente a melhorar um projeto passo a passo, preparando uma tarefa e executando o ciclo do AgentPilot, que propõe, testa e pontua mudanças.
openspace
7,8 milAjuda seu agente a configurar o OpenSpace, uma ferramenta que armazena e busca skills de agentes, e a conectá-la ao seu app de IA pelo MCP.
rsi-arena
7,8 milAjuda seu agente a configurar e rodar testes padrão de benchmark de IA, como AIME e Terminal-Bench, para comparar diferentes métodos de melhoria.
experiment-guide
7,8 milAjuda seu agente a planejar pequenos experimentos, ler seus resultados e registrar descobertas enquanto investiga como melhorar um programa.
Skills parecidas
feishu-doc
394 milAjuda seu agente a ler, criar e editar documentos na nuvem do Feishu, incluindo textos, imagens e tabelas, usando a ferramenta de documentos.
feishu-drive
394 milPermite que seu agente navegue, organize e comente arquivos de uma pasta na nuvem do Feishu que foi compartilhada com o bot.
feishu-perm
394 milAjuda seu agente a verificar e alterar quem pode acessar um arquivo do Feishu, escolhendo a menor permissão que atende ao seu pedido.