[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HXVRRSWCV9BR349AB0AZWH":3,"skill-same:01M6HXVRRSWCV9BR349AB0AZWH":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":42,"linkOnly":43,"markdownContent":44,"markdownBody":45,"frontMatter":46,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":6,"updatedAt":54,"install":55,"resources":68},"01M6HXVRRSWCV9BR349AB0AZWH","reliable-excel-workbook-creation",null,"Use run_shell with cd and heredoc syntax for complex Excel operations when read_file fails on XLSX or execute_code_sandbox fails on multi-step workbook creation","HKUDS\u002FAgentPilot","HKUDS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118165258?v=4","01M6HW8VRNZP64G0P4MVJW2KKQ","✨Data Intelligence Lab@HKU✨","01M6HW8VWZVHBRHYH3T330PFWV",8029,"MIT","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Freliable-excel-workbook-creation\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"reliable excel workbook creation","workbook","creation","xlsx","operations","for","with","multi","cd","use","execute","read","syntax","shell","file","code","run","sandbox","2026-11-10 10:12:30",false,"---\nname: reliable-excel-workbook-creation\ndescription: Use run_shell with cd and heredoc syntax for complex Excel operations when read_file fails on XLSX or execute_code_sandbox fails on multi-step workbook creation\n---\n\n# Reliable Excel Workbook Creation via Shell\n\n## When to Use This Pattern\n\nUse this technique when you need to:\n- Create complex Excel workbooks with multiple sheets\n- Perform multi-step workbook operations (create, populate, format, save)\n- Work with XLSX files that `read_file` cannot handle properly\n- Avoid failures from `execute_code_sandbox` on persistent file operations\n\n**Avoid:** `read_file` for XLSX files, `execute_code_sandbox` for multi-step workbook creation\n\n## Core Pattern\n\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\n# Your Excel operations here\nwb = Workbook()\n# ... create sheets, add data, save\nwb.save('\u002Fworkspace\u002Ffilename.xlsx')\nEOF\n```\n\n## Step-by-Step Instructions\n\n### Step 1: Change to Workspace Directory\nAlways start with `cd \u002Fworkspace &&` to ensure file paths resolve correctly.\n\n### Step 2: Use Heredoc with Single-Quoted EOF\nUse `\u003C\u003C 'EOF'` (single quotes) to prevent shell variable expansion within the Python code.\n\n### Step 3: Write Complete Python Script\nInclude all imports, workbook creation, data population, and save operations in one script.\n\n### Step 4: Use Absolute Paths for Save Operations\nAlways save with full path: `\u002Fworkspace\u002Fyour_filename.xlsx`\n\n## Complete Example\n\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill\n\n# Create workbook\nwb = Workbook()\n\n# Create multiple sheets\nsheets = ['Summary', 'Data', 'Analysis', 'Settings']\nfor sheet_name in sheets:\n    wb.create_sheet(title=sheet_name)\n\n# Remove default sheet if needed\nif 'Sheet' in wb.sheetnames:\n    del wb['Sheet']\n\n# Populate data\nws = wb['Data']\nws['A1'] = 'Item'\nws['B1'] = 'Value'\nws['A2'] = 'Revenue'\nws['B2'] = 100000\n\n# Apply formatting\nheader_font = Font(bold=True)\nfor cell in ws['1:1']:\n    cell.font = header_font\n\n# Save workbook\nwb.save('\u002Fworkspace\u002Freport.xlsx')\nprint('Workbook created successfully: \u002Fworkspace\u002Freport.xlsx')\nEOF\n```\n\n## Why This Works\n\n| Approach | Problem | Solution |\n|----------|---------|----------|\n| `read_file` | Cannot parse XLSX binary format | Don't use for Excel files |\n| `execute_code_sandbox` | File persistence issues, multi-step failures | Use `run_shell` instead |\n| `run_shell` with heredoc | ✓ Reliable, full control, persistent files | **Use this pattern** |\n\n## Common Operations\n\n### Create Multi-Sheet Workbook\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nwb = Workbook()\nsheet_names = ['Sheet1', 'Sheet2', 'Sheet3']\nfor name in sheet_names:\n    wb.create_sheet(title=name)\nwb.save('\u002Fworkspace\u002Fmulti_sheet.xlsx')\nEOF\n```\n\n### Read and Modify Existing Workbook\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import load_workbook\nwb = load_workbook('\u002Fworkspace\u002Fexisting.xlsx')\nws = wb.active\nws['A1'] = 'Updated Value'\nwb.save('\u002Fworkspace\u002Fexisting.xlsx')\nEOF\n```\n\n### Add Formulas\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nwb = Workbook()\nws = wb.active\nws['A1'] = 100\nws['A2'] = 200\nws['A3'] = '=SUM(A1:A2)'\nwb.save('\u002Fworkspace\u002Fwith_formulas.xlsx')\nEOF\n```\n\n## Troubleshooting\n\n- **File not found**: Ensure you use `\u002Fworkspace\u002F` prefix in all paths\n- **Permission errors**: Verify workspace directory is writable\n- **Module not found**: openpyxl is pre-installed in the environment\n- **Heredoc issues**: Use single-quoted `'EOF'` to prevent shell interpretation\n\n## Best Practices\n\n1. **Always use absolute paths** (`\u002Fworkspace\u002Ffilename.xlsx`)\n2. **Single-quoted heredoc** (`\u003C\u003C 'EOF'`) prevents variable expansion\n3. **Complete script in one heredoc** - avoid splitting operations\n4. **Print confirmation** after save to verify success\n5. **Handle exceptions** for production scripts","# Reliable Excel Workbook Creation via Shell\n\n## When to Use This Pattern\n\nUse this technique when you need to:\n- Create complex Excel workbooks with multiple sheets\n- Perform multi-step workbook operations (create, populate, format, save)\n- Work with XLSX files that `read_file` cannot handle properly\n- Avoid failures from `execute_code_sandbox` on persistent file operations\n\n**Avoid:** `read_file` for XLSX files, `execute_code_sandbox` for multi-step workbook creation\n\n## Core Pattern\n\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\n# Your Excel operations here\nwb = Workbook()\n# ... create sheets, add data, save\nwb.save('\u002Fworkspace\u002Ffilename.xlsx')\nEOF\n```\n\n## Step-by-Step Instructions\n\n### Step 1: Change to Workspace Directory\nAlways start with `cd \u002Fworkspace &&` to ensure file paths resolve correctly.\n\n### Step 2: Use Heredoc with Single-Quoted EOF\nUse `\u003C\u003C 'EOF'` (single quotes) to prevent shell variable expansion within the Python code.\n\n### Step 3: Write Complete Python Script\nInclude all imports, workbook creation, data population, and save operations in one script.\n\n### Step 4: Use Absolute Paths for Save Operations\nAlways save with full path: `\u002Fworkspace\u002Fyour_filename.xlsx`\n\n## Complete Example\n\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill\n\n# Create workbook\nwb = Workbook()\n\n# Create multiple sheets\nsheets = ['Summary', 'Data', 'Analysis', 'Settings']\nfor sheet_name in sheets:\n    wb.create_sheet(title=sheet_name)\n\n# Remove default sheet if needed\nif 'Sheet' in wb.sheetnames:\n    del wb['Sheet']\n\n# Populate data\nws = wb['Data']\nws['A1'] = 'Item'\nws['B1'] = 'Value'\nws['A2'] = 'Revenue'\nws['B2'] = 100000\n\n# Apply formatting\nheader_font = Font(bold=True)\nfor cell in ws['1:1']:\n    cell.font = header_font\n\n# Save workbook\nwb.save('\u002Fworkspace\u002Freport.xlsx')\nprint('Workbook created successfully: \u002Fworkspace\u002Freport.xlsx')\nEOF\n```\n\n## Why This Works\n\n| Approach | Problem | Solution |\n|----------|---------|----------|\n| `read_file` | Cannot parse XLSX binary format | Don't use for Excel files |\n| `execute_code_sandbox` | File persistence issues, multi-step failures | Use `run_shell` instead |\n| `run_shell` with heredoc | ✓ Reliable, full control, persistent files | **Use this pattern** |\n\n## Common Operations\n\n### Create Multi-Sheet Workbook\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nwb = Workbook()\nsheet_names = ['Sheet1', 'Sheet2', 'Sheet3']\nfor name in sheet_names:\n    wb.create_sheet(title=name)\nwb.save('\u002Fworkspace\u002Fmulti_sheet.xlsx')\nEOF\n```\n\n### Read and Modify Existing Workbook\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import load_workbook\nwb = load_workbook('\u002Fworkspace\u002Fexisting.xlsx')\nws = wb.active\nws['A1'] = 'Updated Value'\nwb.save('\u002Fworkspace\u002Fexisting.xlsx')\nEOF\n```\n\n### Add Formulas\n```bash\ncd \u002Fworkspace && python3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nwb = Workbook()\nws = wb.active\nws['A1'] = 100\nws['A2'] = 200\nws['A3'] = '=SUM(A1:A2)'\nwb.save('\u002Fworkspace\u002Fwith_formulas.xlsx')\nEOF\n```\n\n## Troubleshooting\n\n- **File not found**: Ensure you use `\u002Fworkspace\u002F` prefix in all paths\n- **Permission errors**: Verify workspace directory is writable\n- **Module not found**: openpyxl is pre-installed in the environment\n- **Heredoc issues**: Use single-quoted `'EOF'` to prevent shell interpretation\n\n## Best Practices\n\n1. **Always use absolute paths** (`\u002Fworkspace\u002Ffilename.xlsx`)\n2. **Single-quoted heredoc** (`\u003C\u003C 'EOF'`) prevents variable expansion\n3. **Complete script in one heredoc** - avoid splitting operations\n4. **Print confirmation** after save to verify success\n5. **Handle exceptions** for production scripts",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Freliable-excel-workbook-creation",944,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot","https:\u002F\u002Fgithub.com\u002FHKUDS","https:\u002F\u002Fsites.google.com\u002Fview\u002Fchaoh","2026-11-12 22:26:39",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add HKUDS\u002FAgentPilot --skill reliable-excel-workbook-creation",{"tool":61,"command":62},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill reliable-excel-workbook-creation",{"tool":64,"command":65},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill reliable-excel-workbook-creation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Freliable-excel-workbook-creation\u002FSKILL.md",true,[69],{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},".skill_id","OTHER","其他",46,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Freliable-excel-workbook-creation\u002F.skill_id",[76,93,112,135,158,180],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":42},"01M6HYB297NDABRERJRVG0K8R0","agentpilot","Set up AgentPilot and use its single entry to prepare missing inputs and run configured RSI experiments. Use when the user requests AgentPilot installation or work with AgentPilot.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fplugins\u002Fagentpilot\u002Fskills\u002Fagentpilot\u002FSKILL.md",[],[78,83,84,30,85,86,87,88,33,89,90,91,40,92],"prepare","requests","missing","installation","rsi","up","user","work","SET","experiments",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":42},"01M6HYAYWXTTE1J7DJM0MFNQ4H","remember","Review auto-memory entries and propose promotions to OPENSPACE.md, OPENSPACE.local.md, or retained auto-memory topics; detect duplicates, stale facts, conflicts, and ambiguous entries before making changes.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fskills\u002Fremember\u002FSKILL.md",[],[95,100,101,102,103,104,105,106,107,108,109,110,111],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale","duplicates",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":121,"publishedAt":42},"01M6HYAVMPM4SBDV60R2B5HPV8","skill-discovery","Search reusable OpenSpace skills locally, and browse cloud packages step by step when a cloud skill may help. Reusing proven skills saves tokens, improves reliability, and extends your capabilities beyond built-in tools.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fskill-discovery\u002FSKILL.md",[118],{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[122,123,124,103,125,126,127,128,129,130,131,132,133,134],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":142,"publishedAt":42},"01M6HYAR811B3RB0M50RBEDGN6","delegate-task","Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fdelegate-task\u002FSKILL.md",[141],{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},[143,144,145,103,146,147,148,149,150,124,102,33,151,152,153,29,154,155,156,157],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","tool","stack","share","tasks","automation","MCP",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":42},"01M6HYAM9FSGV6E52AYENDQXYH","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[165,166,167,168,169,170,171,172,38,173,174,175,176,177,29,178,179],"write special chars ts check","write","check","type","files","filters","only","template","python","typescript","output","Existing","type-checking","errors","script",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":42},"01M6HYAH05HGV7SVWSVR8PJRQD","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[187,188,166,30,29,179,189,190,191,192,35,172,38,193,194,173],"write special chars readback","readback","helper","post","via","scripts","verification","cleanup"]