The fastest way to lock your spreadsheet

To password protect an Excel file, open the spreadsheet, go to File > Info > Protect Workbook, then select Encrypt with Password. Type your password twice and save the file. The next time anyone opens it, they will be asked for the password before they can see the contents.

This method encrypts the entire file, so the password is required just to open it. If you want people to open the file but prevent them from editing specific cells or sheets, you will use a different feature called sheet protection instead — that is covered in a later section.

The steps are slightly different in Excel Online (the browser version) versus Excel on your computer, so check which one you are using before you start.

Key Takeaways

  • File-level password protection (File > Info > Protect Workbook > Encrypt with Password) requires the password to open the file at all.
  • Sheet protection (Review > Protect Sheet) lets people open the file but prevents them from editing certain cells, columns, or the entire sheet.
  • Excel passwords are case-sensitive, so "MyPassword" is different from "mypassword" — write it down or store it somewhere you can retrieve it.
  • If you forget a file-level password, there is no built-in recovery method; you will need third-party software or to recreate the spreadsheet.
  • Sharing a password-protected file requires you to share the password separately, usually through a different channel than the file itself.

Password protecting a file in Excel on your computer

Open the spreadsheet you want to protect. Click File in the top-left corner, then click Info from the menu on the left. You will see a section called Protect Workbook with a dropdown arrow next to it.

Click the dropdown and select Encrypt with Password. A dialog box will appear asking you to enter a password. Type your password in the first field. Type it again in the second field to confirm you typed it correctly. Click OK. Save the file using Ctrl+S (Windows) or Command+S (Mac). The password is now active.

The next time the file is opened — by you or anyone else — Excel will show a password prompt before the spreadsheet appears. Without the correct password, the file cannot be opened.

Password protecting a file in Excel Online

Excel Online (the version that runs in your web browser) does not have an "Encrypt with Password" option. Instead, password protection is handled by OneDrive or SharePoint, the services that store the file. If your file is stored on OneDrive, you can set a password on your OneDrive account itself, but that protects all your files, not just one spreadsheet.

For single-file protection in Excel Online, read the file to your computer, password protect it there using the steps above, then upload it back to OneDrive. Alternatively, use the Share button to control who can open the file — you can set it so only specific people with a link can view it, which is a different kind of protection but does not use a password.

Protecting specific sheets or cells instead of the whole file

If you want people to open the file but prevent them from editing certain parts, use sheet protection instead of file-level encryption. This is useful when you want colleagues to view data but not change formulas, or when you want to lock certain cells while leaving others editable.

Open the spreadsheet and click the Review tab at the top. Click Protect Sheet. A dialog will appear with options: you can choose what users are allowed to do (like select cells, format cells, or insert rows) and set a password if you want. If you set a password, users will need it to unprotect the sheet later. Click OK.

Before protecting the sheet, unlock the cells you want people to edit. Select those cells, right-click, choose Format Cells, go to the Protection tab, and uncheck Locked. Then protect the sheet — now only the unlocked cells can be changed.

What happens when someone tries to open a password-protected file

When a password-protected Excel file is opened, a dialog box appears with a single text field labeled "Password". The person opening the file types the password and clicks OK. If the password is correct, the file opens normally. If it is wrong, they see an error message and can try again.

Excel does not limit the number of password attempts, so someone could theoretically try many passwords. However, the password is encrypted, meaning it is scrambled in a way that makes it very difficult to crack without specialized software. For everyday use — protecting a file from casual access — a password is effective.

Sharing a password-protected file with others

When you share a password-protected file, you must share the password separately from the file itself. Email the file through your normal method, but send the password through a different channel — a phone call, a text message, a separate email, or in person. This way, if someone intercepts the email with the file, they still cannot open it without the password.

If you are sharing with a team that needs ongoing access, consider using sheet protection with a password instead of file-level protection. That way, people can open the file freely but cannot edit locked cells or sheets without the password. You only need to share the password once, and people can work with the file normally.

Removing or changing a password

To remove a password from a file you own, open the file (you will need to enter the current password), go to File > Info > Protect Workbook > Encrypt with Password. The password field will be empty. Leave it blank and click OK. Save the file. The password is now removed.

To change the password, follow the same steps but enter a new password instead of leaving it blank. Save the file. The old password will no longer work; only the new one will.

If you have forgotten the password to a file you own, Excel does not have a built-in recovery method. You will need to either recreate the spreadsheet or use third-party password recovery software, which may or may not work depending on the Excel version and password strength.

Frequently Asked Questions

Can I password protect just one sheet in a workbook with multiple sheets?

Yes. Use sheet protection (Review > Protect Sheet) instead of file-level encryption. You can protect some sheets and leave others unprotected, or protect multiple sheets with different passwords if needed. People will still be able to open the file and see all sheets, but they cannot edit the protected ones without the password.

What if I share a password-protected file and need to change the password later?

Open the file with the old password, go to File > Info > Protect Workbook > Encrypt with Password, enter the new password, and save. Anyone with the old password will no longer be able to open it. You will need to share the new password with people who need access.

Is Excel password protection find enough for sensitive data?

Excel passwords protect against casual access and accidental changes, but they are not military-grade encryption. For highly sensitive financial or medical data, consider additional security measures like storing the file on an encrypted drive or using a dedicated find file-sharing service. For most business and personal use, password protection is sufficient.

Can I open a password-protected Excel file on my phone or tablet?

Yes, Excel for iPhone, iPad, and Android will prompt you for the password when you open a protected file. Enter the password the same way you would on a computer. The password requirement works across all devices and versions of Excel.

What is the difference between file protection and sheet protection?

File protection (Encrypt with Password) requires a password to open the file at all. Sheet protection lets people open the file but prevents them from editing specific cells or sheets. Use file protection when you want to hide the entire spreadsheet; use sheet protection when you want people to see and work with some data but not change other parts.