How to Recover Excel File Password (2 Easy Ways)

If you forget the password for your Excel file, you won’t be able to extract data from it or make new inputs. However, there are a few ways to retrieve the password.

Dataset-Recover Excel File Password


Excel File Encryption Types

You can encrypt the Excel workbook with a 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

On the other hand, file encryption with Protect Sheet protects only a singular worksheet. 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


Method 1 – Applying VBA Macro to Recover an Excel File Password

The code tries iterations of probable passwords and generates a workable password to unprotect the worksheet.

This method works if the encrypted file is saved as the Excel 97-2003 Workbook(*xls) type as shown in the following picture.

Saved File-Recover Excel File Password

Steps:

  • Use Alt + F11 or go to the Developer tab and click on Visual Basic (in the Code section).
  • The Microsoft Visual Basic window opens. Select Insert and click on Module.

Module

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

  • 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 cause freezing or lagging. Refrain from running other memory- and CPU-intensive programs while running the code.


Method 2 – Removing Excel File Password Using the Zip Tool

Note
The method doesn’t work if the file is protected using the Encrypt with Password feature.

Steps:

  • In the device directory, select the encrypted file, and go to View in the Files Manager ribbon.
  • Check File name extensions. File Explorer will show the file types (i.e., xlsx).

Zip-Recover Excel File Password

  • Modify the File Extension to .zip.

File extension conversion

  • You’ll get a confirmation window, so click on Yes.

Confirmation window

  • The file gets converted into a zip file.
  • Double-click on it.

Double click

  • Double-click on the folder named xl.

Double Click

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

Copy file by draging

  • Open the file using Notepad.

Notepad

  • Use Ctrl + F to bring out the Find window.
  • Type in protect then click on Find Next in the window.
  • Notepad highlights the “protect” text within the file text.

Find window

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

Deleting protection text portion

  • Save the file using File and going to Save.

File saving

  • Copy and Replace the newly saved sheet1.xml file into the zip.

Copy and Replace

  • Change the File Extension from zip back to xlsx.

File extension conversion

  • Open the modified xlsx file and you should be able to edit this version of the file.

Converted Excel File

Read More: How to Remove Password from Excel File


Download the Excel Workbook


Related Articles


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

Get FREE Advanced Excel Exercises with Solutions!
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