[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KFFQZM8N96KATMCHJTBQ29":3,"skill-same:01M6KFFQZM8N96KATMCHJTBQ29":63},{"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":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":14,"repositoryHtmlUrl":38,"repositoryHomepageUrl":6,"ownerHtmlUrl":39,"ownerBlogUrl":40,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M6KFFQZM8N96KATMCHJTBQ29","excel-unmerge-before-write",null,"Unmerge merged cells in openpyxl worksheets before writing values to avoid AttributeError","xyliu-cs\u002FOpenSpace-GDPval","xyliu-cs","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F89236536?v=4","01M6KF8Z1V4TXS86CKSH48BY8T","xy","01M6KF8Z67443W0SHXM85JEF0B",0,"MIT","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格","SCENARIO","使用场景",[24,25,26,27,28,29],"xlsx","write","excel unmerge before write","writing","openpyxl","values","2026-11-10 10:12:30",false,"---\nname: excel-unmerge-before-write\ndescription: Unmerge merged cells in openpyxl worksheets before writing values to avoid AttributeError\n---\n\n# Excel Unmerge Before Write\n\nWhen automating Excel file population with openpyxl, merged cells in templates can cause write failures. This skill provides the pattern to safely handle merged ranges before populating data.\n\n## When to Use\n\n- Working with Excel templates that have pre-existing merged cells\n- Getting `AttributeError` when trying to write values to certain cells\n- Needing to populate data in areas that may contain merged ranges\n\n## Core Pattern\n\nBefore writing values to cells in a worksheet, identify and unmerge any overlapping ranges:\n\n```python\nfrom openpyxl import load_workbook\n\n# Load the workbook\nwb = load_workbook('template.xlsx')\nws = wb.active\n\n# Unmerge specific ranges before writing\nws.unmerge_cells('A46:C46')\nws.unmerge_cells('E46:F46')\nws.unmerge_cells('I46:K46')\n\n# Now safely write values\nws['A46'] = 'Value 1'\nws['E46'] = 'Value 2'\nws['I46'] = 'Value 3'\n\nwb.save('output.xlsx')\n```\n\n## Step-by-Step Instructions\n\n1. **Identify merged ranges** in your target worksheet:\n   ```python\n   print(ws.merged_cells.ranges)\n   ```\n\n2. **Unmerge relevant ranges** before writing any data to those areas:\n   ```python\n   for merged_range in ws.merged_cells.ranges:\n       # Optionally filter by area if you only need specific ranges\n       ws.unmerge_cells(str(merged_range))\n   ```\n\n3. **Write your data** to the now-unmerged cells:\n   ```python\n   ws.cell(row=46, column=1, value='Your data')\n   ```\n\n4. **Save the workbook**:\n   ```python\n   wb.save('output.xlsx')\n   ```\n\n## Handling Multiple Worksheets\n\nIf your workbook has multiple sheets with merged cells:\n\n```python\nfor sheet_name in wb.sheetnames:\n    ws = wb[sheet_name]\n    for merged_range in list(ws.merged_cells.ranges):\n        ws.unmerge_cells(str(merged_range))\n```\n\n## Common Errors\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `AttributeError` on cell write | Writing to merged cell | Call `unmerge_cells()` first |\n| `KeyError` on range | Invalid range string | Use exact range format like `'A1:B2'` |\n| Data overwrites neighbors | Unmerged too broadly | Unmerge only needed ranges |\n\n## Best Practices\n\n- **Unmerge early**: Call `unmerge_cells()` immediately after loading the worksheet, before any write operations\n- **List before unmerging**: Capture `ws.merged_cells.ranges` before unmerging if you need to know what was merged\n- **Preserve formatting**: If merge was for visual formatting, consider re-applying merges after data population if needed\n- **Test ranges**: Verify unmerged ranges don't break template layout expectations\n\n## Complete Example\n\n```python\nfrom openpyxl import load_workbook\n\ndef populate_excel_template(template_path, output_path, data_dict):\n    \"\"\"Populate an Excel template, handling merged cells safely.\"\"\"\n    wb = load_workbook(template_path)\n    ws = wb.active\n    \n    # Unmerge all cells that might conflict with data writes\n    for merged_range in list(ws.merged_cells.ranges):\n        ws.unmerge_cells(str(merged_range))\n    \n    # Populate data\n    for cell_ref, value in data_dict.items():\n        ws[cell_ref] = value\n    \n    wb.save(output_path)\n    return output_path\n```","# Excel Unmerge Before Write\n\nWhen automating Excel file population with openpyxl, merged cells in templates can cause write failures. This skill provides the pattern to safely handle merged ranges before populating data.\n\n## When to Use\n\n- Working with Excel templates that have pre-existing merged cells\n- Getting `AttributeError` when trying to write values to certain cells\n- Needing to populate data in areas that may contain merged ranges\n\n## Core Pattern\n\nBefore writing values to cells in a worksheet, identify and unmerge any overlapping ranges:\n\n```python\nfrom openpyxl import load_workbook\n\n# Load the workbook\nwb = load_workbook('template.xlsx')\nws = wb.active\n\n# Unmerge specific ranges before writing\nws.unmerge_cells('A46:C46')\nws.unmerge_cells('E46:F46')\nws.unmerge_cells('I46:K46')\n\n# Now safely write values\nws['A46'] = 'Value 1'\nws['E46'] = 'Value 2'\nws['I46'] = 'Value 3'\n\nwb.save('output.xlsx')\n```\n\n## Step-by-Step Instructions\n\n1. **Identify merged ranges** in your target worksheet:\n   ```python\n   print(ws.merged_cells.ranges)\n   ```\n\n2. **Unmerge relevant ranges** before writing any data to those areas:\n   ```python\n   for merged_range in ws.merged_cells.ranges:\n       # Optionally filter by area if you only need specific ranges\n       ws.unmerge_cells(str(merged_range))\n   ```\n\n3. **Write your data** to the now-unmerged cells:\n   ```python\n   ws.cell(row=46, column=1, value='Your data')\n   ```\n\n4. **Save the workbook**:\n   ```python\n   wb.save('output.xlsx')\n   ```\n\n## Handling Multiple Worksheets\n\nIf your workbook has multiple sheets with merged cells:\n\n```python\nfor sheet_name in wb.sheetnames:\n    ws = wb[sheet_name]\n    for merged_range in list(ws.merged_cells.ranges):\n        ws.unmerge_cells(str(merged_range))\n```\n\n## Common Errors\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `AttributeError` on cell write | Writing to merged cell | Call `unmerge_cells()` first |\n| `KeyError` on range | Invalid range string | Use exact range format like `'A1:B2'` |\n| Data overwrites neighbors | Unmerged too broadly | Unmerge only needed ranges |\n\n## Best Practices\n\n- **Unmerge early**: Call `unmerge_cells()` immediately after loading the worksheet, before any write operations\n- **List before unmerging**: Capture `ws.merged_cells.ranges` before unmerging if you need to know what was merged\n- **Preserve formatting**: If merge was for visual formatting, consider re-applying merges after data population if needed\n- **Test ranges**: Verify unmerged ranges don't break template layout expectations\n\n## Complete Example\n\n```python\nfrom openpyxl import load_workbook\n\ndef populate_excel_template(template_path, output_path, data_dict):\n    \"\"\"Populate an Excel template, handling merged cells safely.\"\"\"\n    wb = load_workbook(template_path)\n    ws = wb.active\n    \n    # Unmerge all cells that might conflict with data writes\n    for merged_range in list(ws.merged_cells.ranges):\n        ws.unmerge_cells(str(merged_range))\n    \n    # Populate data\n    for cell_ref, value in data_dict.items():\n        ws[cell_ref] = value\n    \n    wb.save(output_path)\n    return output_path\n```",{"name":5,"description":7},"main","af1b40a42167d09c30b3a63000aa14ace4c1e229","gdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval","https:\u002F\u002Fgithub.com\u002Fxyliu-cs","https:\u002F\u002Fxyliu-cs.github.io","PhD Student in CS, CUHK-Shenzhen.","2026-04-06 20:32:15",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add xyliu-cs\u002FOpenSpace-GDPval --skill excel-unmerge-before-write",{"tool":49,"command":50},"bunx","bunx skills add xyliu-cs\u002FOpenSpace-GDPval --skill excel-unmerge-before-write",{"tool":52,"command":53},"pnpm","pnpm dlx skills add xyliu-cs\u002FOpenSpace-GDPval --skill excel-unmerge-before-write","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write\u002FSKILL.md",true,[57],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},".skill_id","OTHER","其他",40,"https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write\u002F.skill_id",[64,77,85,101,126,146],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":30},"01M6KG8MF1S664SWBDENYRSCK8","zip-export-deliverable","Ensures codebase deliverables are properly exported as ZIP archives through a dedicated finalization step","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fzip-export-deliverable\u002FSKILL.md",[],[71,72,73,74,75,76],"zip export deliverable","zip","export","deliverables","codebase","as",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":30},"01M6KG8GAZWHHEK7VNJDW0ME21","zip-deliverable-finalization","Ensure codebase deliverables are properly packaged as ZIP exports in a dedicated final step","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fzip-deliverable-finalization\u002FSKILL.md",[],[84,72,74,75,76],"zip deliverable finalization",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":30},"01M6KG8CMQQ1PYMNTSRZ9VS1MD","zero-iteration-failure-analysis","Identify and handle agent failures with 0 iterations as pre-execution system issues","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fzero-iteration-failure-analysis\u002FSKILL.md",[],[92,93,94,95,96,97,98,99,76,100],"failure analysis","ZeRO","analysis","iteration","zero iteration failure analysis","with","issues","execution","system",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":112,"publishedAt":30},"01M6KG86W3PA07FT9W58YHHERM","write-file-fallback-report","Generate professional documents using write_file when primary data sources fail, leveraging embedded domain knowledge instead of external retrieval","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fwrite-file-fallback-report\u002FSKILL.md",[107],{"categoryNo":108,"categoryName":109,"taxonomyType":110,"taxonomyTypeDesc":111},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[113,25,114,115,116,117,118,119,120,121,122,123,124,125],"fallback","file","report","write file fallback report","domain","professional","sources","retrieval","generate","embedded","documents","data","knowledge",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":135,"publishedAt":30},"01M6KG82GAEY3GG77CMGCK1C2T","fallback-doc-with-delegation","Generate professional documents after tool failures using shell_agent for complex formats or write_file for simple text\u002Fmarkdown","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fwrite-file-fallback-report-enhanced\u002FSKILL.md",[132],{"categoryNo":133,"categoryName":134,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[136,97,113,137,138,139,123,121,114,140,141,142,25,143,118,144,145],"fallback doc with delegation","doc","delegation","shell","markdown","tool","text","simple","formats","for",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":153,"publishedAt":30},"01M6KG7WT7GX5NYCGEFHW22NV7","context-anchored-fallback-report","Generate documents with write_file when retrieval tools fail, with explicit guardrails against task context drift","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fwrite-file-fallback-report-enhanced-4bc5c2\u002FSKILL.md",[152],{"categoryNo":108,"categoryName":109,"taxonomyType":110,"taxonomyTypeDesc":111},[113,115,154,155,121,114,156,157,25,158,159,120,97,160,123],"context","context anchored fallback report","Guardrails","Tools","task","drift","context drift"]