Excel Xlsx Format Preserving Repair - ChatGPT/Codex/Claude skill A developer released a skill for ChatGPT, Codex, and Claude that preserves Excel .xlsx formatting and Mac compatibility when editing existing workbooks. The skill treats the workbook as an Office Open XML package, modifying only necessary parts and avoiding LibreOffice or Excel round-trips to maintain style fidelity. It includes techniques for preserving namespace prefixes, shared formulas, and cached values to prevent repair prompts and style drift. | name | excel-xlsx-format-preserving-repair | |---|---| | description | Preserve formatting and Excel-for-Mac compatibility when editing existing .xlsx workbooks, especially when prior outputs opened with repair prompts or subtle style drift. Can also extend to other Microsoft Office formats as needed. | Use this skill when editing an existing .xlsx and the user cares that the result looks like the original and opens cleanly in Microsoft Excel. It is especially relevant for financial/model workbooks, row/column deletion, formula rewrites, files from email threads, or any workbook that previously triggered an Excel repair dialog. Treat the workbook as an Office Open XML package. Change only the parts required for the requested edit, and copy every other ZIP member through unchanged. Do not use a LibreOffice or Excel round-trip as the first solution when formatting fidelity matters. Those tools can make a workbook openable, but they may rewrite styles.xml , theme files, workbook metadata, dimensions, default fonts, and other formatting details. Use round-trips only as diagnostics or explicit fallback, and say when they were used. If the normal spreadsheet tooling cannot preserve an existing workbook's look, use direct package manipulation with zipfile plus an XML parser instead of rebuilding the workbook through a high-level library. - Inspect the original package before editing. - Unzip/read with zipfile ; record xl/styles.xml , xl/theme/theme1.xml , and xl/sharedStrings.xml size/hash. - Identify target sheets via xl/workbook.xml and xl/ rels/workbook.xml.rels . - Inspect relevant rows/cells directly in xl/worksheets/sheetN.xml . - Unzip/read with - Preserve formatting by copying structure, not recreating it. - Copy original rows/cells when possible; update only r references, formulas, labels, and values that must change. - Preserve row attributes, column definitions, s style ids, number formats, merged cells, conditional formats, data validations, page setup, print settings, sheet protection, and drawing/media parts unless the request requires changing them. - Keep shared strings unless text changes require a deliberate update; inline strings are acceptable for small new labels if that matches the local pattern. - Copy original rows/cells when possible; update only - Keep formulas, but prefer cached values over broken formulas. - Expand shared formulas before moving rows if the serializer or transform cannot safely preserve shared-formula anchors. - Rewrite row/column references only when you can map them correctly. - If a formula references removed content and cannot be rewritten safely, remove the formula and keep its cached value. - For unsupported xlfn. dynamic-array formulas, infer purpose from cached spill values. If the formula is not needed, replace the spill range with normal values and remove dynamic-array metadata such as cm from those cells. - Preserve namespace prefixes that mc:Ignorable names.- XML serializers may drop unused namespace declarations or rename them to ns0 , ns1 , etc. Excel for Mac can reject the workbook even when unzip/zip tests pass. - Register known Excel namespaces before serialization, and after serialization verify every prefix in mc:Ignorable is declared on that XML root. - Common prefixes seen in modern Excel files include: mc : http://schemas.openxmlformats.org/markup-compatibility/2006 x14ac : http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac x15 : http://schemas.microsoft.com/office/spreadsheetml/2010/11/main x15ac : http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac xr : http://schemas.microsoft.com/office/spreadsheetml/2014/revision xr2 : http://schemas.microsoft.com/office/spreadsheetml/2015/revision2 xr3 : http://schemas.microsoft.com/office/spreadsheetml/2016/revision3 xr6 : http://schemas.microsoft.com/office/spreadsheetml/2016/revision6 xr10 : http://schemas.microsoft.com/office/spreadsheetml/2016/revision10 xcalcf : http://schemas.microsoft.com/office/spreadsheetml/2018/calcfeatures - XML serializers may drop unused namespace declarations or rename them to - Remove stale calculation chains after structural edits. - Delete xl/calcChain.xml . - Remove its