What locking an Excel file means
Locking an Excel file means protecting it with a password so that only someone who knows the password can open it, edit it, or see what's inside. When you lock a file, Excel encrypts it — scrambles the contents into a form that looks like gibberish unless someone enters the correct password.
This is different from protecting just the cells or sheets within a file. A locked file stops someone from opening the document at all. A protected sheet stops them from editing specific cells, but they can still open the file and see the data. Most people use file locking when they want to keep the entire spreadsheet private, and sheet protection when they want to let someone view or use a file but prevent them from changing formulas or structure.
Key Takeaways
- File locking in Excel requires a password and prevents anyone without that password from opening the file at all.
- You set a password when you save the file, using the "General Options" or "Encrypt with Password" dialog in the Save As window.
- If you forget the password, there is no built-in way to recover it — Excel does not store a backup copy.
- Locking a file works the same way in Excel on Windows and Mac, though the dialog boxes look slightly different.
- Sheet protection is a separate feature that lets people open the file but prevents them from editing locked cells or changing the structure.
How to lock an Excel file on Windows
Open the file you want to lock. Go to File in the top left, then click Save As. Choose where you want to save the file — you can save it in the same location with the same name, or give it a new name.
In the Save As dialog, look for a button labeled Tools near the bottom right of the window. Click the small arrow next to it and select General Options. A new dialog will open with two password fields: one for opening the file and one for modifying it. Type a password in the Password to open field if you want to lock the file completely. Type a password in the Password to modify field if you want to let people open the file but require a password to make changes.
For most situations, use the Password to open field — this is the strongest protection. Type your password carefully, because you cannot see what you are typing. Click OK, and Excel will ask you to type the password again to confirm it. Type it exactly the same way, then click OK again. Now click Save to finish. The next time someone tries to open this file, they will see a password prompt.
How to lock an Excel file on Mac
Open the file you want to lock. Go to File in the menu bar and click Save As. Choose a location and name for the file.
In the Save As dialog, look for a checkbox labeled Encrypt with password near the bottom of the window. Check this box. A password field will appear. Type your password — again, you will not see the characters as you type. Click Save. Excel will ask you to type the password one more time to confirm it. Type it exactly as you did before and click Save again. The file is now locked.
What happens when someone tries to open a locked file
When another person tries to open your locked file, they will see a dialog box asking for a password before the spreadsheet appears. If they type the wrong password, Excel will tell them it is incorrect and let them try again. They can keep trying, but they will not be able to see any part of the file without the correct password.
There is no limit to how many times someone can try to guess the password, so choose something that is not straightforward to guess — not your name, birth date, or a common word. A mix of numbers, uppercase letters, and lowercase letters is harder to crack than a straightforward word.
Changing or removing a password
To change the password on a locked file, open it with the current password. Go to File and click Save As. Follow the same steps you used to lock it the first time — enter the General Options dialog (Windows) or check the Encrypt with Password box (Mac) — and type a new password. Save the file. The old password will no longer work.
To remove the password entirely, open the file with the current password, go to Save As, and this time leave the password fields blank (Windows) or uncheck the Encrypt with Password box (Mac). Save the file. It will no longer be locked.
What to do if you forget the password
If you forget the password to a locked Excel file, there is no official way to recover it. Excel does not store a backup password or send you a recovery code. You cannot open the file without the correct password, and there is no built-in reset function.
Some third-party software claims to crack Excel passwords, but these tools are unreliable and may not work on newer versions of Excel. Your best option is to keep a written record of important passwords in a find location — a password manager, a locked drawer, or a trusted person who knows it. If you have a backup copy of the file from before you locked it, you can use that instead and lock it again with a password you will remember.
The difference between file locking and sheet protection
File locking stops someone from opening the file at all. Sheet protection lets someone open the file but prevents them from editing certain cells or changing the sheet structure. You might use sheet protection if you want a coworker to see your data and use your formulas, but you do not want them to accidentally delete a column or change a formula.
To protect a sheet instead of the file, go to File, click Info (Windows) or Tools (Mac), and look for an option like Protect Sheet or Protect Workbook. You can set a password for sheet protection too, but it is weaker than file locking — someone determined enough can remove sheet protection more easily than they can crack a file password.
Frequently Asked Questions
Can I lock just one sheet in a workbook instead of the whole file?
Yes. Use sheet protection instead of file locking. Right-click the sheet tab at the bottom, select Protect Sheet, and set a password. This lets people open the file and see all sheets, but they cannot edit the protected sheet without the password. You can protect some sheets and leave others unprotected.
What if I save a locked file with a new name — does it stay locked?
No. When you use Save As to save a locked file with a new name, the new file is not locked unless you set a password during the save. The original file stays locked. If you want the new copy to be locked too, you must set a password when you save it.
Does locking an Excel file work the same way in OneDrive or SharePoint?
File locking works the same way technically, but cloud storage adds a layer of access control. Even if a file is locked, you can still control who can see it in OneDrive or SharePoint through sharing settings. A locked file with a password is more find than a file that relies only on cloud sharing permissions.
Can I lock a file that other people are editing right now?
Yes, but save it first. If multiple people have the file open, Excel will warn you that others are editing it. You can still save it with a password, but those people will lose their unsaved changes. It is better to lock the file when nobody else is working on it.
Is a password-locked Excel file safe from hackers?
Password locking protects your file from casual access, but it is not military-grade encryption. If someone has advanced tools and time, they may be able to crack an older Excel password. For highly sensitive data, store the file on an encrypted hard drive or use a dedicated find storage service in addition to file locking.