[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJ44JY7HFBM3ZCM43TE6SN":3,"skill-same:01M6KJ44JY7HFBM3ZCM43TE6SN":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":13,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M6KJ44JY7HFBM3ZCM43TE6SN","excel-heredoc-workaround",null,"Create Excel files with openpyxl by falling back to run_shell with inline Python heredoc when execute_code_sandbox fails","AG064\u002FOpenSpace","AG064","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184930299?v=4","01M6KHVFG7TB73NHX3RDYSTMH2","01M6KHVFMM7XA2PZA9Z83PHS3V",0,"MIT","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-heredoc-workaround\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000004","电子表格","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36],"xlsx","excel heredoc workaround","python","sandbox","create","run","code","shell","execute","files","back","with","openpyxl","inline","2026-11-10 10:12:30",false,"---\nname: excel-heredoc-workaround\ndescription: Create Excel files with openpyxl by falling back to run_shell with inline Python heredoc when execute_code_sandbox fails\n---\n\n# Excel Heredoc Workaround\n\n## Purpose\n\nWhen 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.\n\n## When to Use\n\n- You need to create `.xlsx` files with openpyxl\n- `execute_code_sandbox` fails with openpyxl-related errors\n- You need styling, formatting, or complex spreadsheet features\n- Direct shell execution with Python heredoc is available\n\n## Step-by-Step Instructions\n\n### Step 1: Attempt execute_code_sandbox First\n\nTry creating the Excel file using `execute_code_sandbox`:\n\n```python\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill\n\nwb = Workbook()\nws = wb.active\nws.title = \"Data\"\n\n# Add data and styling\nws['A1'] = \"Header\"\nws['A1'].font = Font(bold=True)\n\nwb.save(\"output.xlsx\")\nprint(\"ARTIFACT_PATH:output.xlsx\")\n```\n\n### Step 2: If Sandbox Fails, Use run_shell with Heredoc\n\nWhen `execute_code_sandbox` fails, switch to `run_shell` with a Python heredoc:\n\n```bash\npython3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill, Border, Side\n\n# Create workbook\nwb = Workbook()\nws = wb.active\nws.title = \"Schedule\"\n\n# Add headers with styling\nheaders = [\"Task\", \"Date\", \"Status\", \"Priority\"]\nfor col, header in enumerate(headers, 1):\n    cell = ws.cell(row=1, column=col, value=header)\n    cell.font = Font(bold=True, size=12)\n    cell.fill = PatternFill(start_color=\"4472C4\", end_color=\"4472C4\", fill_type=\"solid\")\n    cell.font = Font(bold=True, color=\"FFFFFF\")\n    cell.alignment = Alignment(horizontal=\"center\")\n\n# Add data rows\ndata = [\n    [\"Cleanup Zone A\", \"2024-01-15\", \"Pending\", \"High\"],\n    [\"Cleanup Zone B\", \"2024-01-16\", \"Complete\", \"Medium\"],\n]\n\nfor row_idx, row_data in enumerate(data, 2):\n    for col_idx, value in enumerate(row_data, 1):\n        cell = ws.cell(row=row_idx, column=col_idx, value=value)\n        cell.alignment = Alignment(horizontal=\"left\")\n\n# Adjust column widths\nfor col in ws.columns:\n    max_length = 0\n    column = col[0].column_letter\n    for cell in col:\n        try:\n            if len(str(cell.value)) > max_length:\n                max_length = len(str(cell.value))\n        except:\n            pass\n    ws.column_dimensions[column].width = max_length + 2\n\n# Save the file\nwb.save(\"Cleanup_Schedule.xlsx\")\nprint(\"Created Cleanup_Schedule.xlsx successfully\")\nEOF\n```\n\n### Step 3: Verify File Creation\n\nAfter running the heredoc script, verify the file was created:\n\n```bash\nls -lh *.xlsx\n```\n\n### Step 4: Optional - Read Back to Confirm\n\nUse `read_file` to confirm the Excel file is valid:\n\n```\nread_file with filetype=\"xlsx\", file_path=\"Cleanup_Schedule.xlsx\"\n```\n\n## Key Advantages\n\n| Aspect | execute_code_sandbox | run_shell heredoc |\n|--------|---------------------|-------------------|\n| Reliability | May fail with openpyxl | More stable execution |\n| Styling support | Limited | Full openpyxl support |\n| File output | Via ARTIFACT_PATH | Direct file write |\n| Debugging | Limited output | Full stdout\u002Fstderr |\n\n## Common Styling Patterns\n\n### Bold Headers with Colored Background\n\n```python\nfrom openpyxl.styles import Font, PatternFill\n\nheader_fill = PatternFill(start_color=\"4472C4\", end_color=\"4472C4\", fill_type=\"solid\")\nheader_font = Font(bold=True, color=\"FFFFFF\", size=12)\n\ncell = ws.cell(row=1, column=1, value=\"Header\")\ncell.fill = header_fill\ncell.font = header_font\n```\n\n### Alternating Row Colors\n\n```python\nfrom openpyxl.styles import PatternFill\n\ngray_fill = PatternFill(start_color=\"D9D9D9\", end_color=\"D9D9D9\", fill_type=\"solid\")\n\nfor row in range(2, ws.max_row + 1):\n    if row % 2 == 0:\n        for col in range(1, ws.max_column + 1):\n            ws.cell(row=row, column=col).fill = gray_fill\n```\n\n### Borders and Alignment\n\n```python\nfrom openpyxl.styles import Border, Side, Alignment\n\nthin_border = Border(\n    left=Side(style='thin'),\n    right=Side(style='thin'),\n    top=Side(style='thin'),\n    bottom=Side(style='thin')\n)\n\nfor row in ws.iter_rows():\n    for cell in row:\n        cell.border = thin_border\n        cell.alignment = Alignment(horizontal=\"center\", vertical=\"center\")\n```\n\n## Troubleshooting\n\n**Issue**: File not created after heredoc execution\n- **Fix**: Check stdout for Python errors; ensure working directory is correct\n\n**Issue**: openpyxl not found\n- **Fix**: Install with `pip install openpyxl` before running heredoc\n\n**Issue**: Styling not appearing\n- **Fix**: Ensure you save the workbook after applying all styles\n\n## Example Complete Workflow\n\n```bash\n# Create Excel with full styling\npython3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill, Border, Side\n\nwb = Workbook()\nws = wb.active\nws.title = \"Report\"\n\n# Header row\nheaders = [\"ID\", \"Name\", \"Value\", \"Date\"]\nfor col, h in enumerate(headers, 1):\n    cell = ws.cell(row=1, column=col, value=h)\n    cell.font = Font(bold=True, color=\"FFFFFF\")\n    cell.fill = PatternFill(start_color=\"2F5597\", fill_type=\"solid\")\n    cell.alignment = Alignment(horizontal=\"center\")\n\n# Data\nws.append([1, \"Item A\", 100, \"2024-01-01\"])\nws.append([2, \"Item B\", 200, \"2024-01-02\"])\n\n# Apply borders\nthin = Side(style='thin')\nborder = Border(left=thin, right=thin, top=thin, bottom=thin)\nfor row in ws.iter_rows():\n    for cell in row:\n        cell.border = border\n\n# Auto-width columns\nfor col in ws.columns:\n    col_letter = col[0].column_letter\n    max_len = max(len(str(cell.value)) if cell.value else 0 for cell in col)\n    ws.column_dimensions[col_letter].width = min(max_len + 2, 50)\n\nwb.save(\"Report.xlsx\")\nprint(\"Success: Report.xlsx created\")\nEOF\n```","# Excel Heredoc Workaround\n\n## Purpose\n\nWhen 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.\n\n## When to Use\n\n- You need to create `.xlsx` files with openpyxl\n- `execute_code_sandbox` fails with openpyxl-related errors\n- You need styling, formatting, or complex spreadsheet features\n- Direct shell execution with Python heredoc is available\n\n## Step-by-Step Instructions\n\n### Step 1: Attempt execute_code_sandbox First\n\nTry creating the Excel file using `execute_code_sandbox`:\n\n```python\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill\n\nwb = Workbook()\nws = wb.active\nws.title = \"Data\"\n\n# Add data and styling\nws['A1'] = \"Header\"\nws['A1'].font = Font(bold=True)\n\nwb.save(\"output.xlsx\")\nprint(\"ARTIFACT_PATH:output.xlsx\")\n```\n\n### Step 2: If Sandbox Fails, Use run_shell with Heredoc\n\nWhen `execute_code_sandbox` fails, switch to `run_shell` with a Python heredoc:\n\n```bash\npython3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill, Border, Side\n\n# Create workbook\nwb = Workbook()\nws = wb.active\nws.title = \"Schedule\"\n\n# Add headers with styling\nheaders = [\"Task\", \"Date\", \"Status\", \"Priority\"]\nfor col, header in enumerate(headers, 1):\n    cell = ws.cell(row=1, column=col, value=header)\n    cell.font = Font(bold=True, size=12)\n    cell.fill = PatternFill(start_color=\"4472C4\", end_color=\"4472C4\", fill_type=\"solid\")\n    cell.font = Font(bold=True, color=\"FFFFFF\")\n    cell.alignment = Alignment(horizontal=\"center\")\n\n# Add data rows\ndata = [\n    [\"Cleanup Zone A\", \"2024-01-15\", \"Pending\", \"High\"],\n    [\"Cleanup Zone B\", \"2024-01-16\", \"Complete\", \"Medium\"],\n]\n\nfor row_idx, row_data in enumerate(data, 2):\n    for col_idx, value in enumerate(row_data, 1):\n        cell = ws.cell(row=row_idx, column=col_idx, value=value)\n        cell.alignment = Alignment(horizontal=\"left\")\n\n# Adjust column widths\nfor col in ws.columns:\n    max_length = 0\n    column = col[0].column_letter\n    for cell in col:\n        try:\n            if len(str(cell.value)) > max_length:\n                max_length = len(str(cell.value))\n        except:\n            pass\n    ws.column_dimensions[column].width = max_length + 2\n\n# Save the file\nwb.save(\"Cleanup_Schedule.xlsx\")\nprint(\"Created Cleanup_Schedule.xlsx successfully\")\nEOF\n```\n\n### Step 3: Verify File Creation\n\nAfter running the heredoc script, verify the file was created:\n\n```bash\nls -lh *.xlsx\n```\n\n### Step 4: Optional - Read Back to Confirm\n\nUse `read_file` to confirm the Excel file is valid:\n\n```\nread_file with filetype=\"xlsx\", file_path=\"Cleanup_Schedule.xlsx\"\n```\n\n## Key Advantages\n\n| Aspect | execute_code_sandbox | run_shell heredoc |\n|--------|---------------------|-------------------|\n| Reliability | May fail with openpyxl | More stable execution |\n| Styling support | Limited | Full openpyxl support |\n| File output | Via ARTIFACT_PATH | Direct file write |\n| Debugging | Limited output | Full stdout\u002Fstderr |\n\n## Common Styling Patterns\n\n### Bold Headers with Colored Background\n\n```python\nfrom openpyxl.styles import Font, PatternFill\n\nheader_fill = PatternFill(start_color=\"4472C4\", end_color=\"4472C4\", fill_type=\"solid\")\nheader_font = Font(bold=True, color=\"FFFFFF\", size=12)\n\ncell = ws.cell(row=1, column=1, value=\"Header\")\ncell.fill = header_fill\ncell.font = header_font\n```\n\n### Alternating Row Colors\n\n```python\nfrom openpyxl.styles import PatternFill\n\ngray_fill = PatternFill(start_color=\"D9D9D9\", end_color=\"D9D9D9\", fill_type=\"solid\")\n\nfor row in range(2, ws.max_row + 1):\n    if row % 2 == 0:\n        for col in range(1, ws.max_column + 1):\n            ws.cell(row=row, column=col).fill = gray_fill\n```\n\n### Borders and Alignment\n\n```python\nfrom openpyxl.styles import Border, Side, Alignment\n\nthin_border = Border(\n    left=Side(style='thin'),\n    right=Side(style='thin'),\n    top=Side(style='thin'),\n    bottom=Side(style='thin')\n)\n\nfor row in ws.iter_rows():\n    for cell in row:\n        cell.border = thin_border\n        cell.alignment = Alignment(horizontal=\"center\", vertical=\"center\")\n```\n\n## Troubleshooting\n\n**Issue**: File not created after heredoc execution\n- **Fix**: Check stdout for Python errors; ensure working directory is correct\n\n**Issue**: openpyxl not found\n- **Fix**: Install with `pip install openpyxl` before running heredoc\n\n**Issue**: Styling not appearing\n- **Fix**: Ensure you save the workbook after applying all styles\n\n## Example Complete Workflow\n\n```bash\n# Create Excel with full styling\npython3 \u003C\u003C 'EOF'\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Alignment, PatternFill, Border, Side\n\nwb = Workbook()\nws = wb.active\nws.title = \"Report\"\n\n# Header row\nheaders = [\"ID\", \"Name\", \"Value\", \"Date\"]\nfor col, h in enumerate(headers, 1):\n    cell = ws.cell(row=1, column=col, value=h)\n    cell.font = Font(bold=True, color=\"FFFFFF\")\n    cell.fill = PatternFill(start_color=\"2F5597\", fill_type=\"solid\")\n    cell.alignment = Alignment(horizontal=\"center\")\n\n# Data\nws.append([1, \"Item A\", 100, \"2024-01-01\"])\nws.append([2, \"Item B\", 200, \"2024-01-02\"])\n\n# Apply borders\nthin = Side(style='thin')\nborder = Border(left=thin, right=thin, top=thin, bottom=thin)\nfor row in ws.iter_rows():\n    for cell in row:\n        cell.border = border\n\n# Auto-width columns\nfor col in ws.columns:\n    col_letter = col[0].column_letter\n    max_len = max(len(str(cell.value)) if cell.value else 0 for cell in col)\n    ws.column_dimensions[col_letter].width = min(max_len + 2, 50)\n\nwb.save(\"Report.xlsx\")\nprint(\"Success: Report.xlsx created\")\nEOF\n```",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fexcel-heredoc-workaround","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace","https:\u002F\u002Fgithub.com\u002FAG064","AG064, E.Mi.\r\n\r\nA person who thinks all the time, yet all they have to think about is nothing. I want to improve the world and work on open source projects","2026-10-08 06:53:48",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add AG064\u002FOpenSpace --skill excel-heredoc-workaround",{"tool":55,"command":56},"bunx","bunx skills add AG064\u002FOpenSpace --skill excel-heredoc-workaround",{"tool":58,"command":59},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill excel-heredoc-workaround","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-heredoc-workaround\u002FSKILL.md",true,[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},".skill_id","OTHER","其他",38,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-heredoc-workaround\u002F.skill_id",[70,92,108,116,146,162],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":37},"01M6KKMPWA0B5SCCH766F8M5EA","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[77,78,79,80,81,82,83,84,85,86,87,32,88,89,90,25,91],"write special chars ts check","check","write","filters","Existing","type-checking","for","errors","script","output","type","only","template","file","typescript",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":37},"01M6KKMJXVBNVEY3TRK055F4A7","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[99,100,79,89,101,102,90,25,103,104,105,106,107,83,85,34],"readback","write special chars readback","cleanup","read","scripts","verification","via","post","helper",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":37},"01M6KKMEGX9M9NC105J0W3Q5B9","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[79,115,25,83,105,89,30,90,85],"write special chars heredoc",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":127,"publishedAt":37},"01M6KKM8EJ2AATVHZBNB916WT0","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[122],{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[128,129,130,131,91,132,133,134,135,136,83,137,138,139,140,141,142,143,144,145],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":37},"01M6KKM39PHYK627F19GE2B9XN","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[153,154,155,156,83,157,34,158,159,160,161],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":37},"01M6KKKY7T2P61Y0JH54CDEJKQ","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[169,170,171,172,173,174,90,175,176,177],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]