Always work on a copy, not the original Before opening, renaming, or editing anything: copy your file to a safe location (a separate folder, a USB drive, or cloud storage). If an edit goes wrong, the copy is your only way back. Never make changes to your only version of the file. As you make edits, save incremental copies of each XML file you change (workbook-v1.xml, workbook-v2.xml) so you can step back to any point.

What a Healthy workbook.xml Looks Like

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
          xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
  <fileVersion appName="xl" lastEdited="7"/>
  <bookViews>
    <workbookView xWindow="0" yWindow="0"
                  windowWidth="28800" windowHeight="12285"
                  activeTab="0"/>
  </bookViews>
  <sheets>
    <sheet name="Sales"   sheetId="1" r:id="rId1"/>
    <sheet name="Summary" sheetId="2" r:id="rId2"/>
  </sheets>
  <definedNames>
    <definedName name="TotalRevenue">Sales!$E$2:$E$9</definedName>
  </definedNames>
  <calcPr calcId="191"/>
</workbook>
📄
CLEAN-sample-workbook.xlsx Clean Reference
A valid XLSX workbook — open, unzip, and inspect this file as a working reference while following the examples above.
Download

Type 1

Broken Sheet Reference: rId Mismatch

Each <sheet> entry has an r:id that links it to a physical file via workbook.xml.rels. If these IDs get out of sync, Excel cannot locate the sheet data.

Excel error message
Removed Part: /xl/worksheets/sheet2.xml part. (Worksheet)
<!-- workbook.xml -->
<sheets>
  <sheet name="Sales"   sheetId="1" r:id="rId1"/>
  <sheet name="Summary" sheetId="2" r:id="rId9"/>  <!-- ← CORRUPT: rId9 does not exist -->
</sheets>

<!-- workbook.xml.rels only has rId1 and rId2 -->
<Relationships>
  <Relationship Id="rId1" Target="worksheets/sheet1.xml"/>
  <Relationship Id="rId2" Target="worksheets/sheet2.xml"/>
</Relationships>

Fix: Change r:id="rId9" to r:id="rId2" so it matches the relationship that actually exists in workbook.xml.rels.

📄
CORRUPT-workbook-rid-mismatch.xlsx Corrupt Example
Sheet 2's r:id points to rId9, which doesn't exist in workbook.xml.rels. Opens in Excel with a "Removed Part" error.
Download
Type 2

Invalid definedName: Broken Named Range

Named ranges that reference deleted sheets or moved data become #REF! in the XML. A badly malformed definedName can prevent the file from opening entirely.

Excel error message
Repaired Records: Named range from /xl/workbook.xml part
<definedNames>
  <definedName name="TotalRevenue">Sales!$E$2:$E$9</definedName>
  <definedName name="OldRegion">#REF!</definedName>    <!-- ← CORRUPT: invalid reference -->
  <definedName name=""></definedName>                  <!-- ← CORRUPT: empty name is invalid -->
</definedNames>

Fix: Delete the corrupt <definedName> entries entirely. Named ranges that no longer point to valid data should be removed rather than left as #REF!.

<!-- Fixed -->
<definedNames>
  <definedName name="TotalRevenue">Sales!$E$2:$E$9</definedName>
</definedNames>
📄
CORRUPT-workbook-broken-definedname.xlsx Corrupt Example
Contains a #REF! named range and an empty-name entry in definedNames. Excel reports a "Repaired Records" warning on open.
Download
Type 3

Bad activeTab Value

The activeTab attribute tracks which sheet is currently selected. If the value is higher than the number of sheets that exist, Excel errors on open.

<!-- workbook has 2 sheets: valid indexes are 0 and 1 -->

<workbookView xWindow="0" yWindow="0"
              windowWidth="28800" windowHeight="12285"
              activeTab="7"/>   <!-- ← CORRUPT: index 7 does not exist -->

Fix: Change activeTab to a valid value. activeTab="0" always works — it points to the first sheet.

<!-- Fixed -->
<workbookView activeTab="0"/>
📄
CORRUPT-workbook-bad-activetab.xlsx Corrupt Example
activeTab is set to 7, but the workbook only has 2 sheets. Excel errors on open.
Download
Type 4

Duplicate sheetId Values

Each <sheet> must have a unique sheetId. Duplicates occur when sheets are copied by a tool that does not properly increment the counter.

<sheets>
  <sheet name="Sales"   sheetId="1" r:id="rId1"/>
  <sheet name="Summary" sheetId="1" r:id="rId2"/>  <!-- ← CORRUPT: duplicate sheetId="1" -->
  <sheet name="Archive" sheetId="3" r:id="rId3"/>
</sheets>

Fix: Make each sheetId unique. Renumber sequentially starting from 1.

<!-- Fixed -->
<sheets>
  <sheet name="Sales"   sheetId="1" r:id="rId1"/>
  <sheet name="Summary" sheetId="2" r:id="rId2"/>
  <sheet name="Archive" sheetId="3" r:id="rId3"/>
</sheets>
📄
CORRUPT-workbook-duplicate-sheetid.xlsx Corrupt Example
Two sheets share sheetId="1". Excel silently drops or errors on the duplicate.
Download

Checklist: How to Check workbook.xml in Your File

  • Rename your XLSX to .zip and open it
  • Navigate to the xl folder, copy workbook.xml to your Desktop
  • Open in VS Code (with the Red Hat XML extension) and press Shift+Alt+F to format
  • Check that every r:id in <sheets> has a matching Id in workbook.xml.rels
  • Check that activeTab value is less than the number of <sheet> entries (e.g. 2 sheets means valid values are 0 and 1)
  • Check that all sheetId values are unique
  • Look for any <definedName> entries containing #REF! or an empty name attribute
workbook.xml open in VS Code with formatted XML structure and syntax highlighting