Forum Discussion
How can I unlock an Excel spreadsheet that is locked for editing?
(1) use zip tools to open Excel workbook
(2) find your sheet under path "xl\worksheets\", which shall be named by its sheetname with ".xml" suffix
(3) use text editor open it and find a tag named "sheetProtection", memo the contents of the tag , delete it from the file
(4) save the xml and replace it in your workbook using zip tools
(5) you can edit the sheet freely
(6) after editing, paste back "sheetProtection" using same approach above, the sheet will be protected by same password again (note, sheetprotection should be placed after </sheetData>)
Note:
this approach is not suitable for password protected workbooks, as they are encrypted zip files
bill-xu I renamed the .xlsx to .zip and managed to find the sheet1.xml from /xl/worksheets/. And only one .xml under this folder.
However, when I opened sheet1.xml file, there is no tag named sheetProtection. Only a sheetView tag shows up.
P.S. This xlsx file was created by Excel 2019.
- bill-xuNov 16, 2023Copper Contributor
this becomes a little complicated...
there may be a tag has two attributes "algorithmName" and "hashValue", the tag's name could be "sheetProtection" or something else depending on the protection mode (maybe?).
you can backup your file first and make a try.
please note, excel workbook contains blob (binary data) in zip file which is not able to be repacked.
so don't decompress its contents into flat files, just use zip tools to edit the file.
winzip, 7zip, etc. can help you replace file inside a zip file without repacking it. (mean just dragging a file from outside into the zip file)
here is a link about ms open spec for office documents in which sheetProtection is explained.
[MS-OI29500]: Part 1 Section 18.3.1.85, sheetProtection (Sheet Protection Options) | Microsoft Learn