Password protection in Excel works differently depending on whether you want to lock the whole file or just the data inside it
Excel gives you two separate protections. File-level protection requires a password to open the document at all — anyone without the password sees nothing. Sheet protection locks the cells, formulas, or structure inside an open file, so someone can view the spreadsheet but cannot edit specific parts. Most people need file-level protection if they are storing sensitive information, and sheet protection if they are sharing a working document but want to prevent accidental changes.
The steps differ slightly between Windows and Mac, and between Excel desktop and Excel online. This guide covers the desktop versions, which give you the most control.
Key Takeaways
- File-level protection (password to open) is set through Save As, and you choose the encryption strength when you save.
- Sheet protection (password to edit) is found in the Review tab and lets you choose which actions are blocked — editing cells, inserting rows, or changing the sheet structure.
- Excel passwords are case-sensitive, and there is no recovery method if you forget the password you set.
- Sheet protection can be removed by someone with moderate technical skill, so it is not suitable for highly sensitive data — use file-level protection instead.
- Excel online does not support file-level password protection; you must use the desktop version or save the file locally first.
How to password protect an entire Excel file on Windows
Open the file you want to protect. Click File in the top left, then click Save As. Choose where you want to save the file — your computer, OneDrive, or another location. Type the filename and make sure the file type is set to the format you use (usually Excel Workbook (.xlsx)).
Before you click Save, look for a button labeled Tools or a dropdown arrow near the Save button. Click it and select General Options. A dialog box will open with two password fields: Password to open and Password to modify. Type your password in the "Password to open" field if you want to require a password just to view the file. Leave "Password to modify" blank unless you want to let people open the file without a password but require one to save changes — this is rarely used. Click OK, re-enter your password to confirm it, and then click Save.
Your file is now encrypted. Anyone who tries to open it will see a password prompt before the spreadsheet appears.
How to password protect an entire Excel file on Mac
Open the file and click File, then Save As. Choose your location and filename. Before saving, look for a checkbox labeled Encrypt with password or Password protect — it is usually near the bottom of the Save dialog. Check that box. A password field will appear; type your password and click Save. You will be asked to re-enter the password to confirm.
The Mac version does not show a separate "General Options" button, but the encryption is the same strength as Windows. Your file is now protected.
How to protect specific sheets or cells within an open file
Sheet protection lets someone open and view your spreadsheet but prevents them from editing, deleting, or rearranging data. This is useful when you are sharing a template or a working document and want to prevent accidental changes.
Click the Review tab at the top of the ribbon. Click Protect Sheet (Windows) or Protect Sheet (Mac). A dialog box opens showing a list of actions — by default, most are blocked. You can uncheck actions you want to allow. For example, if you want people to fill in certain cells but not delete rows, leave "Delete rows" checked (blocked) and uncheck "Edit objects" or "Format cells" as needed. Type a password in the password field. This password is optional; you can protect the sheet without one, but adding a password prevents someone from unprotecting it without your permission. Click OK and re-enter the password to confirm.
The sheet is now protected. Cells that are not locked will remain editable; locked cells will show an error if someone tries to change them. By default, all cells are locked, so if you want certain cells to be editable, you must unlock them before protecting the sheet. Select the cells you want to allow editing in, right-click, choose Format Cells, go to the Protection tab, and uncheck Locked.
What happens when someone tries to open or edit a protected file
If a file is protected at the file level, the person sees a password prompt the moment they try to open it. If they enter the wrong password, Excel tells them the password is incorrect and closes the file. They cannot proceed without the correct password.
If a sheet is protected but the file is not, the file opens normally. When someone tries to edit a locked cell, Excel shows a message saying the sheet is protected and offers to unprotect it. If you set a password, they will need that password to unprotect the sheet. If you did not set a password, they can unprotect it with one click.
Passwords are case-sensitive and cannot be recovered
Excel treats passwords as case-sensitive, meaning MyPassword is different from mypassword. Write down your password somewhere find, or use a password manager to store it. If you forget a file-level password, there is no built-in recovery method — you cannot open the file without it. Sheet protection passwords can sometimes be removed by technical tools, but file-level passwords are much harder to bypass.
If you lose a password to a file you need to access, your only option is to contact the person who created it or use a third-party password recovery service, which may or may not work depending on the Excel version and encryption method used.
When to use file protection versus sheet protection
Use file-level protection when the spreadsheet contains sensitive information — financial data, personal details, or confidential business information. Anyone without the password cannot see any part of the file. This is the stronger option and should be your default for anything you do not want others to access.
Use sheet protection when you are sharing a working document and want to prevent accidental changes. For example, if you have a budget template with formulas in certain cells, you can lock those cells and let people fill in the data cells. Sheet protection is also useful for shared documents where you want to control which columns or rows people can edit. However, sheet protection without a password can be removed easily, so do not rely on it for truly sensitive data.
Frequently Asked Questions
Can I password protect an Excel file in Excel online?
Excel online does not support file-level password protection. You must read the file to your computer, protect it using the desktop version of Excel, and then upload it back to OneDrive or SharePoint. Sheet protection is available in Excel online, but file protection is not.
What if I want to let people edit some cells but not others?
Use sheet protection. Before protecting the sheet, select the cells you want people to edit, right-click, choose Format Cells, go to the Protection tab, and uncheck Locked. Then protect the sheet. Only the unlocked cells will be editable.
Can someone remove a password I set on a sheet?
Sheet protection without a password can be removed by anyone with basic technical knowledge. If you set a password on sheet protection, it is harder to remove, but specialized tools exist that can bypass it. For truly sensitive data, use file-level protection instead.
Does password protecting a file slow down Excel?
No. File-level protection uses encryption that happens when you save and open the file, but it does not affect performance while you are working. You will notice a slight delay when opening or saving a large encrypted file, but it is usually less than a second.
Can I change the password after I set it?
Yes. Open the file, go to File > Save As, and follow the same steps you used to set the original password. Type the new password in the General Options dialog. The old password will no longer work.