Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

Protect Excel file with password – Step by step tutorial

Author Xiaoyang Last modified

When it comes to preserving the integrity and confidentiality of your Excel files, one of the most effective strategies is to protect them with a password. This means that when you open an Excel file, you will need to input a password to access. Password-protecting Excel files not only prevents unauthorized access but also ensures the privacy and security of data in shared spaces. In this tutorial, we'll guide you on how to password-protect your Excel files effectively.

A screenshot showing the prompt to enter a password to open an Excel file

Password protect an Excel file

Password protect multiple Excel files from opening

Password protection warning


Video: Protect Excel file with password


 Password protect an Excel file 

To prevent others from accessing data or modifying the data in your Excel file, you can set a password to protect the Excel file. Excel offers straightforward methods to encrypt an entire workbook with a password, ensuring restricted access or preventing any alterations to the file.

Password protect an Excel file from opening

Securing an Excel file with a password is a great way to keep your data private. If you'd like to set this up, just follow these steps:

Step 1: Select the Encrypt with Password option

  1. Open the workbook you want to set a password for.
  2. Then, click "File" > "Info", and then, click "Protect Workbook" button, and select "Encrypt with Password" in the drop-down list.
    A screenshot of the Protect Workbook option in the File menu of Excel

Step 2: Set the password for protecting the Excel file

  1. In the popped out "Encrypt Document" window, enter a password in the "Password" box, and click "OK".
    A screenshot of the Encrypt Document window for entering a password in Excel
  2. Retype the password in the following "Confirm Password" window, and click "OK".
    A screenshot of the Confirm Password window in Excel

Step 3: Save the workbook

After setting the password, you should save the file for the password protection to take effect.

Result:

Now, every time the workbook is opened, the password will be required.

A screenshot of the Password dialog box in Excel

Tip:

To remove the encryption from the workbook, you should access the workbook first, then follow the same steps as mentioned above. In the Encrypt Document window, delete the password from the Password box, click OK, and then save your workbook.


Never worry about forgetting passwords again!

Do you find yourself forgetting your passwords frequently? Say goodbye to those forgetful moments with Password Manager! With Kutools for Excel's Password Manager, you don't have to worry about that challenge anymore. It can help you:

  • Store your passwords into the Password Manager securely.
  • Enter the password automatically when opening password-protected files.
  • Eliminate the need to memorize passwords.
  • Read more about the tool    Download Kutools
A screenshot of the Password Manager feature in Kutools for Excel

Password protect an Excel file from modifying

Suppose you want others to access your Excel file but prevent modifications, even without knowing the password. In that case, you can set your Excel workbook to read-only and protect it with a password. This allows users to view the data without altering it. Let's go through the steps to activate this protective feature.

Step 1: Select the Save As feature

Open the workbook, and then click "File" > "Save As" > "Browse", see screenshot:
A screenshot of the Save As page in Excel

Step 2: Choose General Options

A "Save As" window will open, give a name to this Excel file into the "File name" box, and then click "General Options" from the Tools drop down. See screenshot:
A screenshot showing how to access General Options in Save As in Excel

Step 3: Set Password to Read Only

  1. In the "General Options" dialog box, type a password in the "Password to modify" text box, and check "Read-only recommended" option. Then, click "OK". See screenshot:
    A screenshot of the General Options dialog for setting Read-only and Modify password in Excel
  2. In the next "Confirm Password" dialog box, enter the password again. And then, click "OK" to close the dialog.
    A screenshot of the Confirm Password dialog for setting a Modify password in Excel

Step 4: Save the workbook

After clicking OK, Excel will get back to the "Save As" window, click "Save" to save this workbook. Now the Excel workbook is both read-only and password-protected.

Step 5: Result (Open Password Protected workbook as Read Only)

  1. From now on, when others open this Excel file, they needn’t type the password, just click "Read Only" button to access the workbook. See screenshot:
    A screenshot showing the Read-Only option when opening a password-protected workbook
  2. When they try to make changes and save the workbook, a warning message box will appear, reminding to save the workbook with a new name or in a different location. And the original workbook will not be affected. See screenshot:
    A screenshot of the warning when attempting to save changes to a Read-only Excel workbook
Tip: Remove Read-only Option and Password

If you want to disable the Read-only recommended option that you previously enabled for an Excel workbook as well as the password, you can follow these steps:

  1. After opening this read-only Excel file, go to "File" > "Save As" > "Browse".
  2. In the "Save As" window, click "Tools" > "General Options". In the "General Options" dialog box, uncheck the "Read-only recommended" option and click "OK". See screenshot:
    A screenshot showing how to disable Read-only recommended option in Excel
  3. Then, click "Save" button, the Excel file will be saved with a new name.
    A screenshot of saving an Excel workbook as a new file
  4. When this newly named workbook is opened next time, a password will not be required, and it will not open as Read-only. You can make changes to the workbook and save it without any restrictions.

Password protect multiple Excel files from opening

When you have multiple Excel files to protect, setting a password for each file individually can be quite tedious and complex. Here, I will introduce you two quick methods to bulk password-protect your Excel files.


Password protect multiple Excel files with just a few clicks by Kutools for Excel

When it comes to managing and protecting multiple Excel files, "Kutools for Excel" can be an excellent option. Its "Encrypt Workbooks" feature allows you to protect numerous Excel files with a same password at once, whether they are stored locally or on your OneDrive cloud storage.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After downloading and installing Kutools for Excel, please click "Kutools Plus" > "Encrypt Workbooks" > "Encrypt Workbooks" to enable this feature. Then follow the below steps:

  1. Click "Add" button to select the Excel files that you want to password-protect. (Either from your local computer or OneDrive cloud) All selected files are added and listed into the list box;
  2. Type a password into the "Use the following password" textbox;
  3. Click "OK" to protect these Excel files.
    A screenshot of the Encrypt Workbooks dialog in Kutools for Excel
Tips:
  1. To apply this feature, please click to download and install Kutools for Excel.
  2. To remove the password from these Excel files, please click "Kutools Plus" > "Encrypt Workbooks" > Decrypt Workbooks. In the "Decrypt Workbooks" dialog box, add the Excel files you want to remove the password, then, type the password to decrypt the workbooks.

Password protect multiple Excel files with VBA code

In the following steps, I will provide you with a VBA code that allows you to protect multiple Excel files with the same password:

Step 1:Open the VBA module editor and copy the code

  1. Hold down the "ALT" + "F11" keys in Excel, and it opens the "Microsoft Visual Basic for Applications" window.
  2. Click "Insert" > "Module", and paste the following code in the "Module" Window.
    VBA code: password protect multiple Excel files
    Sub ProtectAll()
        'Update by Extendoffice
        Dim xWorkBooks As Workbook
        Dim xExitFile As String
        Dim xPassWord As Variant
        Dim xStrPath As String
        Dim xFileDialog As FileDialog
        Dim xFile As String
        On Error Resume Next
        Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
        xFileDialog.AllowMultiSelect = False
        xFileDialog.Title = "Select a folder [Kutools for Excel]"
        If xFileDialog.Show = -1 Then
            xStrPath = xFileDialog.SelectedItems(1)
        End If
        If xStrPath = "" Then
            MsgBox "No folder selected. The process has been canceled.", vbExclamation, "Kutools for Excel"
            Exit Sub
        Else
            xStrPath = xStrPath + "\"
        End If
        
        ' Check if there are Excel files in the selected folder
        xFile = Dir(xStrPath & "*.xls*")
        If xFile = "" Then
            MsgBox "No Excel files found in the selected folder.", vbExclamation, "Kutools for Excel"
            Exit Sub
        End If
        
        xPassWord = Application.InputBox("Enter password", "Kutools for Excel", , , , , , 2)
        If (xPassWord = False) Or (xPassWord = "") Then
            MsgBox "Password cannot be blank!", vbInformation, "Kutools for Excel"
            Exit Sub
        End If
        
        On Error Resume Next
        Application.ScreenUpdating = False
        Do While xFile <> ""
            Set xWorkBooks = Workbooks.Open(xStrPath & xFile)
            Application.DisplayAlerts = False
            xWorkBooks.SaveAs Filename:=xWorkBooks.FullName, Password:=xPassWord
            Application.DisplayAlerts = True
            xWorkBooks.Close False
            Set xWorkBooks = Nothing
            xFile = Dir
        Loop
        Application.ScreenUpdating = True
        MsgBox "Successfully protect!", vbInformation, "Kutools for Excel"
    End Sub  
    

Step 2: Execute the code to password protect all Excel files in a folder

  1. After pasting this code, please press "F5" key to run this code. A "Select a folder" window will appear, select a folder which contains the workbooks that you want to protect with a password. Then, click "OK". see screenshot:
    A screenshot of selecting a folder for protecting Excel files using VBA
  2. In the following prompt box, enter a password for protecting workbooks. And then, click "OK".
    A screenshot of entering a password for protecting Excel files using VBA
  3. After finishing the protection, a prompt box will pop out to remind you all workbooks in the selected folder have been successfully protected, see screenshot:
    A screenshot of the success message after protecting multiple Excel files with VBA
Tip:

To remove the encryption from a workbook, you should access the workbook first. And then, click "File" > "Info" > "Protect Workbook" > "Encrypt with Password". In the "Encrypt Document" window, delete the password from the Password box, click "OK", and then save your workbook.


Password protection warning:

  • "Remember Your Password": Excel does not provide an option to recover the password if you forget it. If you forget the password you set on an Excel file, you might not be able to open the file again. Thus, remembering your password or securely storing it somewhere safe is crucial.
  • "Case Sensitivity": Excel passwords are case-sensitive, so be careful when setting or inputting the password.

This is how you can protect an Excel or multiple Excel files with password. If you're interested in exploring more Excel tips and tricks, our website offers thousands of tutorials, please click here to access them. Thank you for reading, and we look forward to providing you with more helpful information in the future!


Related Articles:

  • Protect multiple worksheets at once
  • Supposing you have a workbook which contains multiple worksheets, and now you need to protect all of the worksheets or some specific worksheets, normally in Excel, you only can protect the sheet one by one with the Protect Sheet function, but this method is tedious and time-consuming if there are numerous sheets need to be protected. How do you protect multiple sheets at once in Excel quickly and easily?
  • Set password to protect hidden sheet
  • If you have a workbook which contains some important hidden worksheets, and do not allow others to unhide them. Now, you need to set a password to protect the hidden worksheets completely, when other users unhide them, they must enter the password. Do you have any ways to deal with this task quickly and easily in Excel?
  • Set passwords to protect individual worksheets by users
  • In Excel, you can set different passwords for different sheets, this means that one user could make changes to one worksheet using one password, and another could use a different password to make changes to another worksheet. But, sometimes, you just only want each user to be able to view and access their own sheet. Is this possible to be solved in Excel?
  • Lock and protect cells in Excel
  • In Excel, it's common to protect all cells from being modified by others. Sometimes, you may only need to protect specific cells or formula cells that shouldn't be changed, while allowing other cells to be edited or modified, as shown in the screenshot below. In this tutorial, we'll introduce quick methods for tackling these tasks in Excel.
{# article_7374_afterDisplayContent #}