Password protection locks your spreadsheet so only people with the password can open it
Excel lets you set a password that someone must enter before they can even open the file. This is different from protecting individual sheets or cells — a file password stops anyone from accessing the spreadsheet at all without the correct password. Once you set it, the file stays locked until you remove the password or someone enters it correctly.
The process takes about two minutes and works the same way in Excel on Windows, Mac, and the web version. You do not need any special tools or add-ons.
Key Takeaways
- File passwords prevent anyone from opening your spreadsheet without entering the correct password first.
- You set the password through the Save As dialog by choosing a format that supports encryption, like .xlsx or .xlsm.
- Write down your password somewhere safe — Excel cannot recover it if you forget it, and you will lose access to your file.
- Passwords protect the file itself, but do not prevent someone from copying data if they open it, so use sheet protection for additional control over what people can edit.
- The web version of Excel (Office.com) does not have a built-in password feature, so you must use the desktop app or save to OneDrive with account-level security.
How to add a password in Excel on Windows
Open the file you want to protect. Go to File in the top left, then click Save As. Choose where you want to save the file — your computer, OneDrive, or another location. Name the file and make sure the file format is set to Excel Workbook (.xlsx) or Excel Macro-Enabled Workbook (.xlsm) if your spreadsheet contains macros.
Before you click Save, look for a button labeled Tools near the bottom right of the Save As dialog. Click the small arrow next to it and select General Options. A dialog box will appear with two password fields: one for opening the file and one for modifying it. Type your password in the Password to open field. Leave the other field blank unless you want a separate password just for editing. Click OK, then re-enter your password to confirm it, then click OK again. Now click Save to finish.
The next time anyone opens this file, they will see a password prompt before the spreadsheet appears. Without the correct password, the file will not open.
How to add a password on Mac
Open your spreadsheet and go to File at the top, then select Save As. Choose your location and name the file. Make sure the file format shows Excel Workbook (.xlsx). Look for a checkbox labeled Encrypt with password and check it. A dialog will appear asking you to enter and confirm your password. Type it in both fields and click OK.
Click Save to finish. The file is now password-protected. On Mac, the password dialog appears automatically when someone tries to open the file.
What happens when someone tries to open a password-protected file
When a user opens a password-protected Excel file, a dialog box appears asking for the password before anything else loads. They cannot see the spreadsheet, the sheet names, or any data until they enter the correct password. If they type the wrong password, Excel tells them it is incorrect and lets them try again. After too many wrong attempts, some versions of Excel will lock them out temporarily.
If someone has the file but not the password, they cannot access it through normal means. They cannot open it in another program, view it in preview, or extract data from it without the password.
The difference between file passwords and sheet protection
A file password prevents anyone from opening the spreadsheet at all. Sheet protection is different — it lets people open the file but prevents them from editing certain cells, deleting sheets, or changing formulas. You might use sheet protection when you want to share a spreadsheet with coworkers but keep them from accidentally changing important calculations.
If you want both layers of security, you can set a file password and also protect individual sheets. Someone would need the file password to open it, and then the sheet password to make changes. For most situations, a file password alone is enough.
What to do if you forget your password
Excel does not have a built-in password recovery tool. If you forget the password to a file you created, you cannot open it. There is no "forgot password" button, no recovery email, and no way to reset it through Microsoft.
This is why you should write down your password somewhere find — a password manager, a locked drawer, or another safe place. If you lose access to the file, third-party password recovery software exists, but it is expensive and not always reliable. The safest approach is to keep a backup copy of important files without a password, stored separately.
Password protection in Excel Online and OneDrive
The web version of Excel at Office.com does not have a password feature built into the Save dialog. If you want to protect a file stored on OneDrive, you can set a password on your Microsoft account instead, which requires anyone to log in before they can access your files. This protects everything in your OneDrive, not just one spreadsheet.
If you need to password-protect a single file, save it with a password using the desktop version of Excel first, then upload it to OneDrive. The password will stay with the file. When someone opens it from OneDrive, they will be prompted for the password before the file loads.
Frequently Asked Questions
Can I change or remove a password after I set it?
Yes. Open the file, go to File and Save As, and follow the same steps as before. Clear the password field to remove the password, or type a new one to change it. You will need to know the current password to open the file in the first place, so you cannot remove a password you have forgotten.
Does a password protect my file if someone steals my computer?
A password protects the file itself, but not your computer. If someone has physical access to your computer, they could potentially copy the file and try to crack the password offline, or access your password manager. For full security, encrypt your entire hard drive using Windows BitLocker or Mac FileVault in addition to password-protecting individual files.
What file formats support password protection?
Excel Workbook (.xlsx) and Excel Macro-Enabled Workbook (.xlsm) both support passwords. Older formats like .xls also work. If you save as CSV or other text formats, the password feature will not be available because those formats do not support encryption.
Can I password-protect a file that is already shared with others?
Yes, but they will lose access until you give them the password. If the file is shared through OneDrive or SharePoint, adding a password to the file itself does not change the sharing settings — it just means they will need the password to open it after they read it.
Is a password enough to keep my spreadsheet find?
A password prevents unauthorized people from opening the file, but it does not prevent someone with the password from copying all your data. If you need to control what people can do after they open it, use sheet protection to lock specific cells or prevent editing. For highly sensitive data, consider whether Excel is the right tool or whether you need a database with more advanced security features.