Forum Discussion
Help with Protect Sheet
- May 02, 2021
As long as you're not talking about cracking an encrypted file, which would be illegal, and only talking about the restrict editing password as you say--then don't worry. Restrict editing passwords are very easy to remove in both Word and Excel.
Here is what you need to do. Make sure that you have enabled seeing file extensions in folders options. Then, change the file extension of the Excel to .zip from .xlsx. Next, open that zip file.
Where you go from here depends on which restriction you enabled.If it was for the whole workbook:
- Open the workbook.xml file and find the xml node that begins "<workbookProtection" like this.
- Highlight from the < character through to the > character following the word "lockStructure" (inclusive) and delete it. That will unlock the workbook.
- Replace the xml in the zip with your changed file, and change the .zip back to .xlsx.
If it is just the sheet:
- Look in the xl folder for the sheet.xml file for your sheet.
- This time find the node beginning "<sheetProtection" through the > following the word "scenarios". Delete that, and this will unlock the sheet.
- Replace the xml in the zip with your changed file, and change the .zip back to .xlsx.
I've written a PowerShell script that will ask you to point it at a folder and loop through all the Word and Excel files therein, removing the restrict editing passwords to all of them. I can provide this to you if you like. I am unable to sign my scripts though, so I understand if you'd rather not run a strangers code on your machine. That said, I am not malicious, and if you'd like to use it I am willing to provide it to you. Nobody else uses it, and I wrote it just to see if I could while messing around with PowerShell.
As long as you're not talking about cracking an encrypted file, which would be illegal, and only talking about the restrict editing password as you say--then don't worry. Restrict editing passwords are very easy to remove in both Word and Excel.
Here is what you need to do. Make sure that you have enabled seeing file extensions in folders options. Then, change the file extension of the Excel to .zip from .xlsx. Next, open that zip file.
Where you go from here depends on which restriction you enabled.
If it was for the whole workbook:
- Open the workbook.xml file and find the xml node that begins "<workbookProtection" like this.
- Highlight from the < character through to the > character following the word "lockStructure" (inclusive) and delete it. That will unlock the workbook.
- Replace the xml in the zip with your changed file, and change the .zip back to .xlsx.
If it is just the sheet:
- Look in the xl folder for the sheet.xml file for your sheet.
- This time find the node beginning "<sheetProtection" through the > following the word "scenarios". Delete that, and this will unlock the sheet.
- Replace the xml in the zip with your changed file, and change the .zip back to .xlsx.
I've written a PowerShell script that will ask you to point it at a folder and loop through all the Word and Excel files therein, removing the restrict editing passwords to all of them. I can provide this to you if you like. I am unable to sign my scripts though, so I understand if you'd rather not run a strangers code on your machine. That said, I am not malicious, and if you'd like to use it I am willing to provide it to you. Nobody else uses it, and I wrote it just to see if I could while messing around with PowerShell.
- BowenR1May 02, 2021Copper Contributor
No...it is not for a malicious purpose. I'm just trying to save myself the time and headache of recreating the spreadsheet.
I have made it this far...Look in the xl folder for the sheet.xml file for your sheet. This time find the node beginning "<sheetProtection" through the > following the word "scenarios". Delete that, and this will unlock the sheet.
I'm not really good with computer speak and don't know a lot about excel. I only protected the worksheet, so I opened the xl file. There isn't a "sheet.xml" file, but there is a "workbook.xml" file. Where would I find the node?
I am currently attempting to do this. I'm hoping you are still online.
Thank you!
- Rich89May 02, 2021Brass Contributor
Alrighty. I've attached some images here to assist you in the order that you need to do them. These images are assuming you have restricted the sheet and not the whole book. When you look in the worksheets folder, you'll see however many sheet.xml files there are as you have in your workbook. Just be sure to choose the correct one. They don't correspond by name, only by order across the bottom of your Excel view. Okay? So, for example, if the sheet you restricted is the 3rd tab, you want sheet3.xml.
What you do is drag the xml file to your desktop, open it with notepad, delete that highlighted bit I'm showing in the one image, save, then drag back into the original location, overwriting the original.
Then close out of the zip and rename it back to .xlsx file extension. BowenR1
- BowenR1May 02, 2021Copper ContributorThis is what I found...
etProtection algorithmName="SHA-512" hashValue="0y8I1nW5880WNsyH+bqK5hWSNfLCcBWxl0st+jw//y64jBxqNUdGncS7QZTwR/DnqwcGjOqpmRLIWtDp5AUxHw==" saltValue="+j12ZWsg7o3dKbkM1nHCgQ==" spinCount="100000" sheet="1" selectLockedCells="1" selectUnlockedCells="1"/>
- Rich89May 02, 2021Brass ContributorThe workbook one you only need if you protected the whole workbook. If it was the sheet, then after you open the zip, there’s a folder called xl, and inside that somewhere is the sheet xml file that you need. One sec i can post a picture if that would be helpful.