Locate and excise sheet protection XML tags, recompress the package, and restore full workbook functionality.
Lesson 2.1: Locating and Excising the Sheet Protection Tag
- Identifying the target worksheet XML
- Editing XML with plain text editors
- Removing the <sheetProtection> tag safely
Open the extracted folder and navigate into the 'xl' subdirectory, followed by 'worksheets'. In this directory, each worksheet corresponds to a numbered XML file (e.g., sheet1.xml, sheet2.xml).
Open the XML file corresponding to the locked sheet using a plain text editor such as Notepad. Do not use a word processor like Microsoft Word, as rich text editors may inject unintended formatting characters that corrupt XML syntax.
In Notepad, press Ctrl + F and search for 'protection'. Locate the tag beginning with '<sheetProtection' and ending with '/>'. This tag contains attributes such as the password hash and specific permission locks. Highlight and delete the entire tag from '<' to '/>', taking care not to delete preceding or subsequent tags. Save the file (Ctrl + S) and close Notepad.
Practical work
- Open the target sheet XML file inside xl/worksheets using Notepad.
- Use Ctrl + F to search for 'protection' and locate the entire <sheetProtection ... /> node.
- Delete the complete tag, save the file with Ctrl + S, and verify the remaining XML remains intact.
Lesson 2.2: Recompression, Extension Restoration, and Verification
- Selecting package contents for recompression
- Converting ZIP back to Excel extension
- Verifying sheet unlock in Excel Review tab
To reconstruct the Excel workbook, navigate to the root of the extracted folder containing '_rels', 'docProps', 'xl', and '[Content_Types].xml'. Select all four items simultaneously. Crucially, do not compress the parent directory; compress only these four root contents by right-clicking and choosing 'Send to' > 'Compressed (zipped) folder'.
Assign a name to the newly created zip file. Next, rename the file extension from .zip back to its original Excel extension (.xlsm for macro-enabled workbooks, or .xlsx for standard workbooks). Confirm the Windows prompt when prompted.
Launch the newly renamed workbook in Microsoft Excel. Navigate to the Review tab. The ribbon will now display 'Protect Sheet' instead of 'Unprotect Sheet', indicating that sheet-level security has been eliminated and cells are immediately editable.
Practical work
- Select the four root package components and compress them into a new .zip archive.
- Rename the resulting .zip file back to .xlsm or .xlsx.
- Open the file in Microsoft Excel and verify that previously locked cells can be modified without a password.