Overview

When working with Excel, it's common to password-protect a file or specific sheets to secure our work. However, there are times when we may forget the password, making it difficult to make necessary adjustments. This guide will show you a step-by-step method to regain access. If the workbook contains multiple tabs and you only need to unlock one, we have a smart strategy for that too!

Important: Make sure to create a backup of your Excel file before proceeding.

Step 1: Isolate the Tab (for large workbooks)

If your workbook has many tabs and you only need to unlock one tab, here’s the simplest strategy:

  1. Open the Excel file.
  2. Right-click the tab you want to work on.
  3. Select Move or Copy → **Create a copy** → (new workbook).
  4. Save this new file as single-tab.xlsx.
  5. Now, follow the steps below to unlock the sheet in this smaller, isolated file.
Why this works: This method ensures that the tab you want to unlock will always be in the file as sheet1.xml. This makes it much easier to find and modify.

Step 2: Extract the Excel File

  1. Rename the file from .xlsx to .zip.
    Tip: If file extensions are hidden, enable them by going to View > File Name Extensions in Windows File Explorer.
  2. Extract the contents of the ZIP file using tools like 7-Zip or WinRAR.
  3. After extraction, you should see the following folder structure:
            /_rels
            /docProps
            /xl
            [Content_Types].xml
            

Step 3: Modify the Worksheet Protection

  1. Go to the xl/worksheets directory.
  2. Open the sheet1.xml file in a text editor (like Notepad++ or Visual Studio Code).
  3. Look for a tag similar to the following in the file:
    <sheetProtection password="CC5A" sheet="1" objects="1" scenarios="1"/>
    Note: The password value (CC5A) is just an example. The actual password in your file may be different.
  4. Remove the entire <sheetProtection> tag or remove the password like this:
    <sheetProtection sheet="1" objects="1" scenarios="1" />

Step 4: Recompress the Files

  1. Select all the contents inside the folder (not the parent folder) that you extracted, such as:
            /_rels
            /docProps
            /xl
            [Content_Types].xml
            
  2. Right-click the selected files and folders, and choose 7-Zip > Add to archive.
    Common Mistake: Do not select the entire parent folder, or it will create an extra layer, and Excel will not recognize the file.
  3. In the 7-Zip options:
    • Set Archive format to zip.
    • Set Compression level to Store (this avoids unnecessary compression).
  4. Rename the newly created ZIP file to filename.xlsx (rename it from .zip to .xlsx).

Step 5: Open the File in Excel

  1. Open Excel, but don't double-click the file.
  2. Use File > Open and select the modified .xlsx file.

What to Do If You See an Error

If you see the error "Excel cannot open the file because the file format or file extension is not valid", it means the ZIP file structure is incorrect.

  • Make sure you did not create an extra parent folder when compressing the file. The file structure should look like:
            /_rels
            /docProps
            /xl
            [Content_Types].xml
            

Power Tips

Tip: If you have multiple sheets to unlock, you can automate the process using a Python script. This allows you to remove protection from all sheets at once.
Python Script Example

Below is a Python script that automatically removes the <sheetProtection> tag from all sheet*.xml files in the xl/worksheets directory.

 import os
 from xml.etree import ElementTree as ET

 # Path to the extracted worksheets folder
 worksheets_path = "path/to/xl/worksheets"

 # Iterate over all XML files in the worksheets directory
 for file in os.listdir(worksheets_path):
     if file.endswith(".xml"):
         file_path = os.path.join(worksheets_path, file)
        
        # Parse the XML
        tree = ET.parse(file_path)
         root = tree.getroot()

         # Find and remove the  tag
         sheet_protection = root.find("{http://schemas.openxmlformats.org/spreadsheetml/2006/main}sheetProtection")
         if sheet_protection is not None:
             root.remove(sheet_protection)
             print(f"Removed protection from {file}")

         # Save the modified XML
         tree.write(file_path)

 print("All sheet protections removed.")

In Conclusion

By carefully following these steps, you can regain access to your protected Excel sheets. If you encounter any issues, double-check that no extra parent folders were zipped and ensure that the <sheetProtection> tag has been properly removed.

Disclaimer

This tutorial is intended solely for ethical and lawful purposes. Our goal is to help users regain access to their own files when passwords are forgotten. We do not support, condone, or encourage any misuse of this information to bypass security on files that do not belong to you. Use this guide responsibly and in accordance with applicable laws and regulations.