How to Recover Excel File Password (2 Easy Ways)

Get FREE Advanced Excel Exercises with Solutions!

Users use passwords to protect their Excel files or worksheets. Unfortunately, there are numerous cases where users also forget their passwords. As a result, users need to recover Excel file password to be able to use their files from time to time. There are numerous tools or software online or offline to remove or recover Excel file passwords. However, we’ll not use any online or offline exclusive tool or software to retrieve Excel file passwords.

Dataset-Recover Excel File Password

In this article, we demonstrate ways to recover or remove an Excel file password using VBA Macro and Zip Tool (Winrar or 7 Zip).


Excel File Encryption Types

There are two kinds of Excel file encryptions. They are:

🔄 Encrypt the Excel Workbook with Password. This encryption requires passwords to open or view the file.

Encryption-Recover Excel File Password

🔺 If you open the encrypted file, excel will display a Password window to input the password to open or view it.

Encryption

🔄 File encryption with Protect Sheet offers only the Excel worksheet protection. In that case, the user needs to enter his/her password to edit or modify the worksheet.


In this article, we focus on the file encryption with Protect Sheet and demonstrate VBA Macro to recover encrypted file passwords. If users open the password-protected sheet, Excel displays a disclaimer, stating the file is a protected file and the user needs to input a password to edit or modify as depicted in the below image.

Warning-Recover Excel File Password

Follow the latter section to retrieve or remove an Excel file password.


1. Applying VBA Macro to Recover Excel File Password

We can recover the forgotten Excel file password using a VBA Macro code. The code tries iterations of probable passwords and in the end, breaks file protection by generating a workable password to unprotect the worksheet.

🔺 Ensure the encrypted file is saved in the prior versions of 2010 Excel (i.e., Excel 97-2003 Workbook(*xls)) as shown in the following picture.

Saved File-Recover Excel File Password

Step 1: Use ALT+F11 or go to the Developer tab > Click on Visual Basic (in the Code section). The Microsoft Visual Basic window opens. Select Insert > Click on Module.

Module

Step 2: Paste the following macro in the Module.

Sub RecoverExcelFilePassword()
Dim u As Integer, v As Integer, w As Integer
Dim x As Integer, y As Integer, z As Integer
Dim u1 As Integer, u2 As Integer, u3 As Integer
Dim u4 As Integer, u5 As Integer, u6 As Integer
On Error Resume Next
For u = 65 To 66: For v = 65 To 66: For w = 65 To 66
For x = 65 To 66: For y = 65 To 66: For u1 = 65 To 66
For u2 = 65 To 66: For u3 = 65 To 66: For u4 = 65 To 66
For u5 = 65 To 66: For u6 = 65 To 66: For z = 32 To 126
ActiveSheet.Unprotect Chr(u) & Chr(v) & Chr(w) & _
Chr(x) & Chr(y) & Chr(u1) & Chr(u2) & Chr(u3) & _
Chr(u4) & Chr(u5) & Chr(u6) & Chr(z)
If ActiveSheet.ProtectContents = False Then
MsgBox "Can use this Password: " & Chr(u) & Chr(v) & _
Chr(w) & Chr(x) & Chr(y) & Chr(u1) & Chr(u2) & _
Chr(u3) & Chr(u4) & Chr(u5) & Chr(u6) & Chr(z)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub

macro

The macro generates iterations of probable passwords and uses them to break the protection.

Afterward, press the F5 key to run the macro. The macro takes quite some time to finish and returns an alternative password to unprotect the Worksheet.

⧭ Warning: Executing the macro may return freezing or hanging your device. So, if you are doing other work on your device you shouldn’t run the macro in that case.


2. Removing Excel File Password Using Zip Tool

By editing a zip xml file, we can remove the protection of a sheet in an Excel file. To do so, follow the steps below.

Note
The method is not for you if the workbook is protected using the Encrypt with Password feature.

Step 1: In the device directory, Select the encrypted file, and go to View > Tick File name extensions. File Explorer will show the selected file types (i.e., xlsx).

Zip-Recover Excel File Password

Step 2: Modify the File Extension to zip from xlsx.

File extension conversion

Step 3: The device system will fetch a confirmation window, click on Yes.

Confirmation window

Step 4: The file gets converted into a zip file. Double click on it.

Double click

Step 5: Inside the zip file, there is a file named xl. Double click on it.

Double Click

Step 6: The xl file holds the protected sheet or sheets. In this case, sheet1.xml is the zipped version of the encrypted Excel file. Copy the file to Desktop or any location.

Copy file by draging

Step 7: Open the File using Notepad.

Notepad

Step 8: Use CTRL+F to bring out the Find window. Type protect then Click on Find Next in the window. Notepad highlights the “protect” text within the file text.

Find window

Step 9: Delete the entire <sheetProtect…..SelectUnlockedCells=”1”/> portion from file text.

Deleting protection text portion

Step 10: Now, save the file Text using File > Save.

File saving

Step 11: Afterward Copy and Replace the newly saved sheet1.xml file with the zipped file’s version of it.

Copy and Replace

Step 12: Change the file types by changing the File Extension from zip to xlsx.

File extension conversion

🔼 In the end, open the modified xlsx file and you see you can edit this version of the file.

Converted Excel File

After being able to access the file, you can execute password protection for the file or worksheets again.

Read More: How to Remove Password from Excel File


Download Excel Workbook


Conclusion

In this article, we demonstrate ways to recover or remove Excel file password. Hope these methods do their job in your case. Comment, if you have further inquiries or have anything to add.


Related Articles


<< Go Back to  Unprotect Workbook in Excel | How to Unprotect in Excel | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Maruf Islam
Maruf Islam

MARUF ISLAM is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role, he creates techy content... Read Full Bio

4 Comments
  1. Once I try to open the zipped file, I keep getting a Windows cannot open folder error

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Dec 10, 2023 at 7:10 PM

      Hello BERNARD

      Thanks for reaching out and posting your observation. The ZIP Tool method mentioned in the article can be applicable If you have a protected sheet within a workbook.

      I have experienced the same error when the workbook is encrypted with a Password. But, if only a sheet is protected, the ZIP Tool works perfectly. When you preserve your workbook with an Encrypted Password, the ZIP Tool method will not work. So, use the VBA code to remove the password from the encrypted workbook. Good luck.

      Regards
      Lutfor Rahman Shimanto
      ExcelDemy

  2. the file open with box showing password. does not allow to open macros.

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Feb 4, 2024 at 3:32 PM

      Hello JITHU

      Thanks for reaching out. You are right about the file not allowing the opening of macros. The password is recovered using the Zip Tool, which will not let you open macros. In the article, the writer has demonstrated the file as a macro-free file when using the Zip tool. That’s why when changing back to the file type Zip to Excel, the .xlsx is used.

      If you are working on a macro-enabled file when recovering a password using Zip Tool, change the file’s extension (when changing the file type Zip to Excel) to .xlsm instead of .xlsx.

      Regards
      Lutfor Rahman Shimanto
      ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo