[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJ4EBVX8485NHYTNRAG46T":3,"skill-same:01M6KJ4EBVX8485NHYTNRAG46T":61},{"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":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":34,"commitSha":35,"skillDirectory":36,"forksCount":13,"repositoryHtmlUrl":37,"repositoryHomepageUrl":6,"ownerHtmlUrl":38,"ownerBlogUrl":6,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M6KJ4EBVX8485NHYTNRAG46T","excel-unmerge-before-write",null,"Unmerge merged cells in openpyxl worksheets before writing values to avoid AttributeError","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-unmerge-before-write\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000004","电子表格","SCENARIO","使用场景",[23,24,25,26,27,28],"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","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write","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":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add AG064\u002FOpenSpace --skill excel-unmerge-before-write",{"tool":47,"command":48},"bunx","bunx skills add AG064\u002FOpenSpace --skill excel-unmerge-before-write",{"tool":50,"command":51},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill excel-unmerge-before-write","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write\u002FSKILL.md",true,[55],{"path":56,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":59,"sourceHtmlUrl":60},".skill_id","OTHER","其他",40,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fexcel-unmerge-before-write\u002F.skill_id",[62,85,102,111,141,157],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":29},"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",[],[69,70,24,71,72,73,74,75,76,77,78,79,80,81,82,83,84],"write special chars ts check","check","filters","Existing","type-checking","for","errors","script","output","type","files","only","template","file","python","typescript",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":29},"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",[],[92,93,24,81,94,95,82,83,96,97,98,99,100,74,76,101],"readback","write special chars readback","cleanup","read","scripts","verification","via","post","helper","with",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":29},"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",[],[24,109,83,74,98,81,110,82,76],"write special chars heredoc","shell",{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":122,"publishedAt":29},"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",[117],{"categoryNo":118,"categoryName":119,"taxonomyType":120,"taxonomyTypeDesc":121},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[123,124,125,126,84,127,128,129,130,131,74,132,133,134,135,136,137,138,139,140],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":29},"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",[],[148,149,150,151,74,152,101,153,154,155,156],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":29},"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",[],[164,165,166,167,168,169,82,170,171,172],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]