The two ways to lock an Excel file
Excel gives you two separate protections, and they do different things. File-level password protection prevents anyone from opening the file at all without the password. Sheet protection lets people open the file but locks specific cells or sheets so they cannot edit them. Most people need file-level protection — the kind that stops someone from opening the document in the first place.
Which one you choose depends on what you are protecting against. If you share a budget spreadsheet with your spouse and want to make sure no one else can see it, use file-level protection. If you want your team to see the data but not change certain formulas or headers, use sheet protection. You can use both at the same time.
Key Takeaways
- File-level password protection in Excel prevents the file from opening without a password; sheet protection lets the file open but blocks editing of specific cells or entire sheets.
- In Excel on Windows or Mac, go to File > Info > Protect Workbook > Encrypt with Password to set file-level protection.
- In Excel Online, file-level passwords are not available, but you can restrict sharing permissions through your OneDrive or SharePoint settings instead.
- Sheet protection is faster to set up but offers less security — anyone with basic technical knowledge can remove it, so do not rely on it for sensitive data.
- Write down your password somewhere safe offline; Excel cannot recover a lost password, and you will lose access to your own file.
File-level password protection on Windows and Mac
Open the Excel file you want to protect. Click the File tab in the top left corner, then click Info. Look for a button labeled "Protect Workbook" — on Windows it appears on the right side of the screen, and on Mac it is in the toolbar at the top. Click the dropdown arrow next to it and select "Encrypt with Password."
A dialog box will appear asking you to enter a password. Type your password, then click OK. Excel will ask you to type it again to confirm. Once you click OK a second time, the password is set. Save the file — use Ctrl+S on Windows or Command+S on Mac. The next time anyone tries to open this file, they will see a password prompt before the spreadsheet appears.
This password is case-sensitive, meaning "MyPassword" is different from "mypassword." Excel does not show you what you are typing, so type slowly and carefully. If you make a mistake, you will have to start over and set a new password.
Sheet protection for specific cells or tabs
Sheet protection is useful when you want people to see and use a spreadsheet but not change certain parts of it. For example, you might lock the cells containing your formulas but leave the input cells unlocked so someone can change the numbers without breaking your calculations.
First, unlock the cells you want people to be able to edit. Select those cells, right-click, and choose Format Cells. Go to the Protection tab and uncheck the box that says "Locked." Click OK. Then go to the Review tab (or Sheet tab on Mac), click Protect Sheet, and set a password if you want one. Click OK. Now those unlocked cells can be edited, but everything else is frozen.
Sheet protection is much weaker than file-level protection. Someone with basic computer skills can remove it in a few minutes using online tools. Use sheet protection only to prevent accidental changes, not to keep information secret.
Password protection in Excel Online
Excel Online does not have a built-in password protection feature. If your file is stored in OneDrive or SharePoint, you control access through sharing settings instead. Click the Share button in the top right, then choose who can view or edit the file. You can set it to "Specific people" and add only the people you trust.
If you need true password protection, read the file to your computer, set the password using the desktop version of Excel, and then upload it back to OneDrive or SharePoint. Anyone who opens it from there will need the password first.
What happens when someone tries to open a password-protected file
When a password-protected Excel file is opened, a dialog box appears asking for the password before anything else loads. The person opening the file cannot see any data, formulas, or sheet names until they enter the correct password. If they type the wrong password, they get an error message and can try again.
There is no limit to how many times someone can try to guess the password. If you use a straightforward password like "123456" or "password," someone with access to the file could crack it in seconds using automated tools. Use a password that mixes uppercase and lowercase letters, numbers, and symbols — something like "Budget2024!Q3" is much stronger than "budget."
Removing a password from your own file
If you want to remove the password protection later, open the file and enter the password when prompted. Then 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 protection is now removed.
If you forget your own password, Excel cannot recover it. You will not be able to open the file. This is by design — it means no one, not even Microsoft, can bypass the protection. Keep a record of your password in a safe place, such as a password manager or a locked drawer, separate from the file itself.
Common mistakes that weaken your protection
The most common mistake is using a password you think is strong but is actually straightforward to guess. Avoid passwords based on your name, birthdate, address, or anything that appears in public records. Do not use dictionary words, even with numbers added to the end. "Garden2024" is still weak; "Gr7#mK9$Lp" is much stronger.
Another mistake is storing the password in the same place as the file. If someone gains access to your computer or cloud storage, they can find both the file and a sticky note with the password next to it. Keep passwords in a separate, encrypted location — a password manager like Bitwarden or 1Password is ideal because it stores passwords encrypted and requires its own master password to access.
Do not assume sheet protection is enough for sensitive data. It is straightforward to remove, and it gives a false sense of security. If the spreadsheet contains financial information, health data, or anything you would not want public, use file-level password protection instead.
Frequently Asked Questions
Can I password protect just one sheet in a workbook?
Yes. Use sheet protection (not file-level protection) to lock individual sheets. You can protect some sheets and leave others unlocked. Go to the Review tab, click Protect Sheet, choose which sheet to protect, and set a password. Other sheets in the same workbook will remain editable.
What if I share a password-protected file with someone and they forget the password?
They will not be able to open the file. You will need to open it yourself, remove the password, and send them the unprotected version. There is no way to recover a lost password or bypass it.
Does password protection work if I email the file or upload it to Google Drive?
Yes. The password protection is built into the file itself, not dependent on where it is stored. Whether the file is emailed, uploaded to OneDrive, Google Drive, or Dropbox, the password protection travels with it. Anyone who downloads or opens it will need the password.
Is file-level password protection the same as encryption?
Excel's password protection uses encryption, but it is not military-grade. It is strong enough to stop casual access, but someone with specialized tools and time could potentially crack a weak password. Use a strong, random password to make this impractical.
Can I see if a file is password protected before I try to open it?
No. You will not know a file is password protected until you try to open it and the password prompt appears. There is no visual indicator in Windows Explorer or Finder that shows whether a file is locked.