Agent skill

Excel Heredoc Workaround

by HKUDS in HKUDS/OpenSpace

Create Excel files with openpyxl by falling back to runshell with inline Python heredoc when executecodesandbox fails

MITAuto-check passedDocuments & Office

Install Excel Heredoc Workaround

skills CLI
$ npx skills add HKUDS/OpenSpace --skill excel-heredoc-workaround -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace excel-heredoc-workaround --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/excel-heredoc-workaround .claude/skills/excel-heredoc-workaround && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
excel-heredoc-workaround
GitHub stars
7.8k
Token cost
~1.5k tokens
SKILL.md length
230 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Create Excel files with openpyxl by falling back to runshell with inline Python heredoc when executecodesandbox fails

  • Works in 4 steps: Attempt execute_code_sandbox First → If Sandbox Fails, Use run_shell with… → Verify File Creation → …
  • Tasks that involve Excel spreadsheets
  • SKILL.md covers Purpose, When to Use, Step-by-Step Instructions and Key Advantages, plus 3 more sections
  • Calls python3 and pip

What it does

Excel Heredoc Workaround is an agent skill from HKUDS/OpenSpace. Create Excel files with openpyxl by falling back to runshell with inline Python heredoc when executecodesandbox fails

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It sits in Documents & Office, covering Excel spreadsheets. It works with Microsoft Excel, openpyxl and Python. The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

When your agent uses it

  • Tasks that involve Excel spreadsheets

Example prompts

  • “/excel-heredoc-workaround”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Attempt execute_code_sandbox First
  2. If Sandbox Fails, Use run_shell with Heredoc
  3. Verify File Creation
  4. Optional - Read Back to Confirm

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Excel Heredoc Workaround loads about 1.5k tokens when it runs. Until then it costs about 36 tokens; SKILL.md has 230 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~36
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 230 words, ~1,476 tokens.

Download SKILL.mdSave it as .claude/skills/excel-heredoc-workaround/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
excel-heredoc-workaround
description
Create Excel files with openpyxl by falling back to run_shell with inline Python heredoc when execute_code_sandbox fails

Excel Heredoc Workaround

Purpose

When creating Excel files with openpyxl, execute_code_sandbox may fail due to environment issues. This skill provides a robust workaround: fall back to run_shell with inline Python heredoc scripts to create properly formatted spreadsheets with styling.

When to Use

  • You need to create .xlsx files with openpyxl
  • execute_code_sandbox fails with openpyxl-related errors
  • You need styling, formatting, or complex spreadsheet features
  • Direct shell execution with Python heredoc is available

Step-by-Step Instructions

Step 1: Attempt execute_code_sandbox First

Try creating the Excel file using execute_code_sandbox:

python
from openpyxl import Workbook
from openpyxl.styles import Font, Alignment, PatternFill

wb = Workbook()
ws = wb.active
ws.title = "Data"

# Add data and styling
ws['A1'] = "Header"
ws['A1'].font = Font(bold=True)

wb.save("output.xlsx")
print("ARTIFACT_PATH:output.xlsx")
Step 2: If Sandbox Fails, Use run_shell with Heredoc

When execute_code_sandbox fails, switch to run_shell with a Python heredoc:

bash
python3 << 'EOF'
from openpyxl import Workbook
from openpyxl.styles import Font, Alignment, PatternFill, Border, Side

# Create workbook
wb = Workbook()
ws = wb.active
ws.title = "Schedule"

# Add headers with styling
headers = ["Task", "Date", "Status", "Priority"]
for col, header in enumerate(headers, 1):
    cell = ws.cell(row=1, column=col, value=header)
    cell.font = Font(bold=True, size=12)
    cell.fill = PatternFill(start_color="4472C4", end_color="4472C4", fill_type="solid")
    cell.font = Font(bold=True, color="FFFFFF")
    cell.alignment = Alignment(horizontal="center")

# Add data rows
data = [
    ["Cleanup Zone A", "2024-01-15", "Pending", "High"],
    ["Cleanup Zone B", "2024-01-16", "Complete", "Medium"],
]

for row_idx, row_data in enumerate(data, 2):
    for col_idx, value in enumerate(row_data, 1):
        cell = ws.cell(row=row_idx, column=col_idx, value=value)
        cell.alignment = Alignment(horizontal="left")

# Adjust column widths
for col in ws.columns:
    max_length = 0
    column = col[0].column_letter
    for cell in col:
        try:
            if len(str(cell.value)) > max_length:
                max_length = len(str(cell.value))
        except:
            pass
    ws.column_dimensions[column].width = max_length + 2

# Save the file
wb.save("Cleanup_Schedule.xlsx")
print("Created Cleanup_Schedule.xlsx successfully")
EOF
Step 3: Verify File Creation

After running the heredoc script, verify the file was created:

bash
ls -lh *.xlsx
Step 4: Optional - Read Back to Confirm

Use read_file to confirm the Excel file is valid:

read_file with filetype="xlsx", file_path="Cleanup_Schedule.xlsx"

Key Advantages

Aspectexecute_code_sandboxrun_shell heredoc
ReliabilityMay fail with openpyxlMore stable execution
Styling supportLimitedFull openpyxl support
File outputVia ARTIFACT_PATHDirect file write
DebuggingLimited outputFull stdout/stderr

Common Styling Patterns

Bold Headers with Colored Background
python
from openpyxl.styles import Font, PatternFill

header_fill = PatternFill(start_color="4472C4", end_color="4472C4", fill_type="solid")
header_font = Font(bold=True, color="FFFFFF", size=12)

cell = ws.cell(row=1, column=1, value="Header")
cell.fill = header_fill
cell.font = header_font
Alternating Row Colors
python
from openpyxl.styles import PatternFill

gray_fill = PatternFill(start_color="D9D9D9", end_color="D9D9D9", fill_type="solid")

for row in range(2, ws.max_row + 1):
    if row % 2 == 0:
        for col in range(1, ws.max_column + 1):
            ws.cell(row=row, column=col).fill = gray_fill
Borders and Alignment
python
from openpyxl.styles import Border, Side, Alignment

thin_border = Border(
    left=Side(style='thin'),
    right=Side(style='thin'),
    top=Side(style='thin'),
    bottom=Side(style='thin')
)

for row in ws.iter_rows():
    for cell in row:
        cell.border = thin_border
        cell.alignment = Alignment(horizontal="center", vertical="center")

Troubleshooting

Issue: File not created after heredoc execution

  • Fix: Check stdout for Python errors; ensure working directory is correct

Issue: openpyxl not found

  • Fix: Install with pip install openpyxl before running heredoc

Issue: Styling not appearing

  • Fix: Ensure you save the workbook after applying all styles

Example Complete Workflow

bash
# Create Excel with full styling
python3 << 'EOF'
from openpyxl import Workbook
from openpyxl.styles import Font, Alignment, PatternFill, Border, Side

wb = Workbook()
ws = wb.active
ws.title = "Report"

# Header row
headers = ["ID", "Name", "Value", "Date"]
for col, h in enumerate(headers, 1):
    cell = ws.cell(row=1, column=col, value=h)
    cell.font = Font(bold=True, color="FFFFFF")
    cell.fill = PatternFill(start_color="2F5597", fill_type="solid")
    cell.alignment = Alignment(horizontal="center")

# Data
ws.append([1, "Item A", 100, "2024-01-01"])
ws.append([2, "Item B", 200, "2024-01-02"])

# Apply borders
thin = Side(style='thin')
border = Border(left=thin, right=thin, top=thin, bottom=thin)
for row in ws.iter_rows():
    for cell in row:
        cell.border = border

# Auto-width columns
for col in ws.columns:
    col_letter = col[0].column_letter
    max_len = max(len(str(cell.value)) if cell.value else 0 for cell in col)
    ws.column_dimensions[col_letter].width = min(max_len + 2, 50)

wb.save("Report.xlsx")
print("Success: Report.xlsx created")
EOF

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/excel-heredoc-workaround of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Excel Heredoc Workaround next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Excel Heredoc Workaround compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Excel Heredoc Workaround this skillHKUDS/OpenSpace7.8k—~1.5kAutomated safety check: PassMIT
Excel Workbook EditorTokenRhythm/opensquilla7.1k—~1.6kAutomated safety check: PassApache-2.0
Kimi XLSXthvroyal/kimi-skills238—~9.5kAutomated safety check: PassNone
Office XLSXopen-octo/octo-agent125—~1.8kAutomated safety check: NotesMIT
Cc Streaming Export Safetydoccker/cc-use-exp1.1k—~2.2kAutomated safety check: PassCustom licence
XLSXnexus-research-lab/nexus151—~501Automated safety check: PassApache-2.0

Similar skills

  • Excel Workbook Editor

    TokenRhythm/opensquilla

    Inspects, edits in place or creates Microsoft Excel .xlsx workbooks with openpyxl, treating each cell as a typed number, string, datetime or formula value.

    7.1k GitHub stars~1.6k tokensUpdated today
    Documents & OfficeAuto-check passed
  • Kimi XLSX

    thvroyal/kimi-skills

    Specialized utility for advanced manipulation, analysis, and creation of spreadsheet files, including (but not limited to) XLSX, XLSM, CSV formats.

    238 GitHub stars~9.5k tokensUpdated 6 mo ago
    Documents & OfficeAuto-check passed
  • Office XLSX

    open-octo/octo-agent

    Create, read, and edit Excel (.xlsx) spreadsheets programmatically with openpyxl — cell values, formulas, styling (fonts/fills/borders/alignment/number formats), merged cells, multiple sheets…

    125 GitHub stars~1.8k tokensUpdated today
    Documents & OfficeAuto-check: notes
  • Cc Streaming Export Safety

    doccker/cc-use-exp

    当实现用户驱动的大文件导出或批量序列化(Excel/CSV/JSON/JSONL/PDF,数据量未知或超过 1 万行/10 MB)时触发;普通小文件下载、静态资源下载、非导出 Writer/Report 类不触发。防止 OOM、临时文件残留、同步导出阻塞 HTTP 线程和表格公式注入。

    1.1k GitHub stars~2.2k tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • XLSX

    nexus-research-lab/nexus

    只要电子表格文件(.xlsx、.xlsm、旧版 .xls、.csv、.tsv)是任务的主要输入或输出,或者需要 被打开、读取、创建、修改,就使用本 Skill。也适用于公式、格式、图表、数据清洗和表格格式转换。

    151 GitHub stars~501 tokensUpdated today
    Documents & OfficeAuto-check passed
  • Office XLSX

    singula-ai/alego

    Read, create, and modify Excel workbooks (.xlsx), including data, formulas, formatting, and pandas analysis.

    109 GitHub starsUsed in 1 repo~2.3k tokens
    Documents & OfficeAuto-check passed

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.8k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.8k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.8k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.8k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Excel Heredoc Workaround

What does Excel Heredoc Workaround do?

Create Excel files with openpyxl by falling back to runshell with inline Python heredoc when executecodesandbox fails. Excel Heredoc Workaround is an agent skill from HKUDS/OpenSpace.

When should I use Excel Heredoc Workaround?

Excel Heredoc Workaround fits situations like: tasks that involve Excel spreadsheets.

How do I install Excel Heredoc Workaround in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill excel-heredoc-workaround -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/excel-heredoc-workaround in HKUDS/OpenSpace) into .claude/skills/excel-heredoc-workaround in your project. Claude Code loads it when a task matches its description.

How do I install Excel Heredoc Workaround in Codex?

Run `npx skills add HKUDS/OpenSpace --skill excel-heredoc-workaround -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/excel-heredoc-workaround in HKUDS/OpenSpace) into .agents/skills/excel-heredoc-workaround in your project. Codex loads it when a task matches its description.

Can I use Excel Heredoc Workaround in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill excel-heredoc-workaround -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/excel-heredoc-workaround, .gemini/skills/excel-heredoc-workaround, .github/skills/excel-heredoc-workaround and .opencode/skills/excel-heredoc-workaround in your project.

What does Excel Heredoc Workaround need to run?

Going by SKILL.md and its folder, Excel Heredoc Workaround needs the command-line tools its instructions call (python3 and pip). Our summary lists: Python 3.

Does Excel Heredoc Workaround access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Excel Heredoc Workaround safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Excel Heredoc Workaround use?

Excel Heredoc Workaround is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Excel Heredoc Workaround use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Excel Heredoc Workaround?

Skills that share tags, products or a category with Excel Heredoc Workaround: Excel Workbook Editor (TokenRhythm/opensquilla, 7.1k stars), Kimi XLSX (thvroyal/kimi-skills, 238 stars), Office XLSX (open-octo/octo-agent, 125 stars) and Cc Streaming Export Safety (doccker/cc-use-exp, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Excel Heredoc Workaround?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,754 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.