Password protection in Excel works at the file level, not the cell level

When you add a password to an Excel file, you're locking the entire workbook so that anyone who opens it must enter the password first. This is different from protecting specific cells or sheets — those features let you lock certain parts while leaving others editable, but they don't require a password to open the file itself. If you want to prevent anyone from even opening the file without a password, file-level protection is what you need.

Excel offers two password options: one to open the file, and one to modify it. The "open" password prevents anyone from viewing the file at all without entering it. The "modify" password lets people open the file in read-only mode without a password, but they need the password to make changes and save. You can use one, both, or neither.

Key Takeaways

  • File-level passwords in Excel prevent the entire workbook from opening without the correct password entered first.
  • You can set a password to open the file, a password to modify it, or both — they work independently.
  • The process differs slightly between Windows and Mac versions of Excel, and between the desktop app and Excel online.
  • Excel does not recover lost passwords, so write down or store your password securely before closing the file.
  • Protecting specific cells or sheets requires a different feature and does not prevent someone from opening the file.

How to password-protect a file in Excel on Windows

Open the file you want to protect. Go to File in the top left, then select Info. On the right side, you'll see a button labeled Protect Workbook — click it and choose Encrypt with Password.

A dialog box will appear asking you to enter a password. Type the password you want to use, then click OK. Excel will ask you to enter it again to confirm you typed it correctly. Once you click OK the second time, the password is set. Save the file — the password takes effect immediately.

The next time anyone opens this file, they'll see a password prompt before the spreadsheet appears. Without the correct password, the file cannot be opened at all.

How to password-protect a file in Excel on Mac

Open the file you want to protect. Click File in the menu bar at the top, then select Info. You'll see a button that says Protect Workbook — click it and choose Encrypt with Password.

A dialog box will ask for your password. Enter it once, click OK, then enter it again to confirm. After you click OK the second time, save the file. The password protection is now active.

Setting separate passwords for opening and editing

If you want different passwords for opening versus editing the file, use the Save As dialog instead of the Encrypt with Password button. Go to File, then Save As. Choose where to save the file and give it a name.

Before you click the final Save button, look for a Tools button (Windows) or Options button (Mac) near the bottom of the dialog. Click it, then select General Options. You'll see two password fields: one for opening the file and one for modifying it. Fill in whichever ones you need, then click OK and Save.

With both passwords set, someone can open the file in read-only mode without a password, but they'll need the modify password to make changes. If you set only an open password, the file cannot be opened without it. If you set only a modify password, the file opens freely but requires a password to edit.

What to do if you forget the password

Excel does not have a password recovery feature. If you forget the password to a file you've protected, there is no built-in way to open it or remove the protection. Some third-party tools claim to recover or remove Excel passwords, but their success varies and they may not work on newer Excel versions.

The best approach is to store your password securely before you close the file for the first time. Write it down in a password manager, a secure note, or another location you can access later. If you lose access to the password and have no backup, you may not be able to open the file again.

Password protection versus sheet and cell protection

Excel also lets you protect individual sheets or lock specific cells so they can't be edited. This is different from file-level password protection. Sheet and cell protection does not prevent someone from opening the file — it only prevents them from changing certain parts of it once it's open.

To protect a sheet, go to Review (or Tools on Mac), then Protect Sheet. You can set a password here too, but the sheet is still visible and readable without it. To lock specific cells, select them first, then go to Format > Cells > Protection and check the Locked box. Then protect the sheet so those locked cells can't be changed.

Use file-level passwords when you want to hide the entire spreadsheet. Use sheet or cell protection when you want people to see the file but not edit certain parts of it.

Password protection in Excel online

Excel online (the version you access through a web browser) does not have a built-in password protection feature. If you need to password-protect a file, you must use the desktop version of Excel on Windows or Mac, set the password there, and then upload the protected file to OneDrive or SharePoint.

When someone opens the file through Excel online, they'll be prompted for the password before they can view or edit it. The protection travels with the file, even though Excel online itself doesn't have the feature to create it.

Frequently Asked Questions

Can I change or remove a password after I've set it?

Yes. Open the file and enter the password when prompted. Then go to File > Info > Protect Workbook > Encrypt with Password. Leave the password field blank and click OK twice to remove the password. To change it, enter the new password instead.

Does password protection work if someone copies the file?

Yes. The password protection is embedded in the file itself, so copying it to another location or device doesn't remove the protection. Anyone who opens the copied file will still need the password.

Can I password-protect just one sheet in a workbook?

Yes, but you'll use sheet protection instead of file-level protection. Go to Review > Protect Sheet, set a password, and only that sheet will be locked. Other sheets in the same workbook remain editable. The file itself still opens without a password.

What happens if someone opens my password-protected file in an older version of Excel?

The password protection should still work in older versions, though very old versions of Excel may not support the encryption method used in newer versions. Test with the oldest version you expect people to use before relying on it.

Is Excel password protection secure?

Excel passwords protect against casual access, but they are not military-grade encryption. If security is critical, consider additional measures like storing the file in an encrypted folder or using a dedicated file encryption tool alongside Excel's built-in protection.