How to Recover Excel File Password (2 Easy Ways)

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).


Download Excel Workbook


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.


2 Easy Ways to Recover Excel File Password

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.


🔄 VBA Macro Code 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.

Read More: How to Recover Previous Version of Excel File (4 Easy Ways)


Similar Readings


🔄 Removing Excel File Password Using Zip Tool

By editing a zip xml file, we can remove the file protection portion of an encrypted file. To do so, perform the below steps.

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 Recover Corrupted Excel File (8 Possible Ways)


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

Maruf Islam

Maruf Islam

My self, Maruf Islam, an engineer and Excel & VBA Content developer on Exceldemy. I enjoy solving problems, finding workable solutions, and most of the part I really like to take on challenges. On Exceldemy I write articles discussing various way outs of Microsoft Excel's stuck ons.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo