Password protection in Excel works differently depending on whether you want to lock the whole file or just prevent edits to specific cells

Excel gives you two separate tools. You can password-protect the file itself so nobody opens it without the password, or you can protect a sheet so people can open the file but cannot change certain cells. Most people want the first one — locking the entire file. That takes about 30 seconds and works the same way in Excel on Windows, Mac, and the web version.

The second option — protecting just a sheet or specific cells — is useful if you want to share a file where people can see and use some data but cannot accidentally (or deliberately) change formulas or locked sections. That requires a few more steps and works best when you know exactly which cells should stay locked.

Key Takeaways

  • To lock an entire Excel file with a password, save it, then use File > Info > Protect Workbook > Encrypt with Password on Windows, or File > Properties > Security on Mac.
  • The password you set is the only way to open the file — if you forget it, Microsoft cannot recover it, so write it down somewhere safe.
  • To prevent edits to specific cells while letting people open the file, protect the sheet through Review > Protect Sheet and choose which actions are allowed.
  • Sheet protection passwords can sometimes be removed by determined users, so it is not a security tool — it is a way to prevent accidental changes.

Locking the entire file on Windows

Open the Excel file you want to protect. Click File in the top left, then click Info. On the right side of the screen, you will see a button that says Protect Workbook with a dropdown arrow next to it. Click that arrow and select Encrypt with Password.

A dialog box will appear asking you to enter a password. Type the password you want to use. Excel will not show you what you are typing — you will see dots instead. Click OK. Excel will ask you to type the password again to confirm it. Type it exactly the same way and click OK. Save the file. The next time anyone tries to open it, they will see a password prompt before the file opens.

Write down your password and store it somewhere safe. If you forget it, there is no recovery option. Microsoft does not have a master key and cannot unlock the file for you.

Locking the entire file on Mac

Open the file in Excel. Click File at the top, then click Properties. A window will open. Look for the Security section and click the button that says Set Password. Type your password in the field that appears, then click OK. Excel will ask you to type it again. Type it exactly the same way and click OK. Save the file using File > Save or Command+S.

The password protection is now active. Anyone who tries to open the file will need to enter the password first.

Locking the entire file in Excel on the web

Open your file in Excel Online (the version you use in your web browser). Click File, then Info. Click Protect Workbook and select Encrypt with Password. Type your password and click OK. Type it again to confirm and click OK. The file is now password-protected.

Anyone who opens the file from your shared link or from OneDrive will need to enter the password. This works even if the file is shared with others — they cannot open it without the password.

Protecting specific cells or sheets instead of the whole file

If you want people to be able to open the file but prevent them from changing certain cells, use sheet protection instead. First, decide which cells should be editable. Select those cells, then right-click and choose Format Cells. Click the Protection tab and uncheck the box that says Locked. Click OK. This marks those cells as unlocked.

Now protect the sheet. Click the Review tab at the top. Click Protect Sheet. A dialog will appear. You can enter a password if you want (optional), and you can choose which actions people are allowed to do — for example, you might let them select cells and enter data but not delete rows or change formulas. Check the boxes for what you want to allow, then click OK. If you entered a password, type it again to confirm.

When the sheet is protected, people can open and use the file, but they cannot change the locked cells. They can still edit the cells you marked as unlocked. If you set a password, they will need that password to unprotect the sheet and make changes to locked areas.

What password protection does and does not do

Encrypting an entire file with a password is strong protection. Someone cannot open the file, see the data, or make changes without the correct password. This is real security — the file is encrypted on your computer and stays encrypted when you send it or store it online.

Sheet protection is weaker. It prevents accidental changes and makes it harder for casual users to edit locked cells, but someone with technical knowledge can remove sheet protection. It is useful for shared files where you want to guide people toward certain cells and prevent mistakes, but do not rely on it to keep sensitive data secret from someone determined to access it.

Removing password protection later

If you encrypted the entire file and want to remove the password, open the file, go to File > Info > Protect Workbook > Encrypt with Password (Windows) or File > Properties > Security > Set Password (Mac), and leave the password field blank. Click OK. Save the file. The password protection is now removed.

To remove sheet protection, click the Review tab and click Unprotect Sheet. If you set a password on the sheet, you will need to enter it. Once unprotected, anyone can edit any cell.

Frequently Asked Questions

What happens if I forget the password to my encrypted file?

You cannot open the file. Microsoft does not store your password and cannot recover it. There is no official way to unlock an encrypted Excel file without the password. Keep your password written down in a safe place, or use a password manager to store it.

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

Yes. You can protect individual sheets separately. Click each sheet tab, go to Review > Protect Sheet, and set different passwords for different sheets if you want. Other sheets in the same workbook can remain unprotected.

Is sheet protection the same as file encryption?

No. File encryption (Encrypt with Password) locks the entire file — nobody can open it without the password. Sheet protection lets people open the file but prevents them from editing locked cells. Sheet protection is easier to remove and is not true security.

Can I share a password-protected Excel file with others?

Yes. Send them the file and tell them the password separately (never in the same email or message). They will need to enter the password when they open it. If the file is on OneDrive or SharePoint, the password protection still applies — they cannot open it without the password.

Does password protection work if I save the file as a different format, like CSV?

No. CSV files and some other formats do not support password protection. If you save an encrypted Excel file as CSV, the password protection is lost. Keep the file in .xlsx format to maintain encryption.