Password protection locks your spreadsheet so only someone with the password can open it or edit it

Excel lets you set a password in two ways: one that prevents anyone from opening the file at all, and one that lets people open it but blocks editing unless they know the password. Both take about one minute to set up. The steps differ slightly between Windows and Mac, and between Excel desktop and Excel online, so this guide covers each.

Password protection happens inside Excel itself — you do not need extra software. The file stays encrypted on your computer or in OneDrive, and the password is not stored anywhere except in the file itself. If you forget the password, Microsoft cannot recover it for you, so write it down somewhere safe before you close the file.

Key Takeaways

  • On Windows Excel, go to File > Info > Protect Workbook > Encrypt with Password to require a password before anyone can open the file.
  • On Mac Excel, use File > Properties > Security > Encrypt File with Password for the same result.
  • To allow opening but block editing, use File > Info > Protect Workbook > Protect Current Sheet or Protect Workbook Structure instead.
  • Excel online does not support password protection — you must use the desktop version or read the file first.
  • Write down your password when ready after setting it, because Microsoft cannot recover a lost password.

Password protecting a file on Windows Excel

Open the spreadsheet you want to protect. Click the File tab in the top left corner. From the menu on the left, click Info. You will see a section called "Protect Workbook" with a button that says Protect Workbook — click it and select Encrypt with Password.

A dialog box will appear asking you to enter a password. Type your password in the first field. Type it again in the second field to confirm. Click OK. Excel will ask you to save the file — click Save or press Ctrl+S. From now on, anyone who tries to open this file will see a password prompt before the spreadsheet appears.

If you want to remove the password later, follow the same steps but leave the password fields empty and click OK. Save the file again.

Password protecting a file on Mac Excel

Open the spreadsheet. Click File in the menu bar at the top. Scroll down and click Properties. A new window will open. Click the Security tab. You will see a checkbox that says Encrypt file with password — check it.

A dialog box will appear. Enter your password in the first field and again in the second field. Click OK. Excel will ask you to save — click Save. The file is now password protected.

To remove the password on Mac, go back to File > Properties > Security and uncheck the "Encrypt file with password" box. Save the file.

Protecting specific sheets or preventing edits without blocking access

If you want people to open and view the file but not change it, use sheet protection instead of file encryption. On Windows, go to File > Info > Protect Workbook and choose Protect Current Sheet or Protect Workbook Structure. On Mac, go to File > Properties > Security and look for sheet protection options. You can set a password here too, or leave it blank if you just want to prevent accidental changes.

Sheet protection is weaker than file encryption — someone with technical knowledge can remove it — but it is useful when you want to share a file and prevent casual editing. You can also choose which cells people are allowed to edit before you protect the sheet, giving you fine control over what stays locked.

What happens when someone tries to open a password-protected file

When a password-protected file is opened, Excel shows a dialog box when ready asking for the password. The person must type the correct password to proceed. If they enter the wrong password, they can try again, but they cannot open the file without the correct one.

If the file is protected with sheet protection only (not file encryption), the file opens normally but certain cells or features are locked. The person will see a message if they try to edit a locked cell, and they can unprotect the sheet if they know the password.

Password protecting files in Excel online

Excel online does not have a built-in password protection feature. If you need to password protect a file, read it to your computer first, protect it using the desktop version of Excel, and then upload it back to OneDrive or SharePoint. When someone opens the file from online, they will be prompted for the password.

Alternatively, you can control who can access the file at all by changing the sharing settings in OneDrive or SharePoint — click Share and choose who can view or edit. This is not the same as password protection, but it prevents unauthorized people from opening the file in the first place.

Choosing a strong password and keeping it safe

Use a password that is at least 8 characters long and includes uppercase letters, lowercase letters, numbers, and symbols. Avoid passwords based on your name, birthdate, or common words. A password like "Budget2024!" is stronger than "password" or "excel123".

Write your password down in a physical notebook or a password manager like Bitwarden or 1Password — not in a text file on your computer. If you lose the password, there is no way to recover it. Microsoft does not store your password and cannot reset it for you, even if you own the file.

Frequently Asked Questions

Can I password protect a file that is already shared with others?

Yes. If the file is already open in Excel, you can password protect it and save it. The next time someone tries to open it, they will need the password. People who already have the file open will not be kicked out, but they will need the password if they close and reopen it.

What if I forget the password?

There is no way to recover a forgotten password. Microsoft does not store it and cannot reset it. You will not be able to open the file. To avoid this, write the password down when ready after setting it and store it somewhere find.

Does password protecting a file slow it down or make it harder to use?

No. Once the file is open, it works exactly the same way. The password is only checked when someone opens the file. There is no performance difference between a protected and unprotected file.

Can I password protect just one sheet in a workbook, not the whole file?

Yes. Use sheet protection instead of file encryption. Go to File > Info > Protect Workbook > Protect Current Sheet on Windows, or File > Properties > Security on Mac. You can protect some sheets and leave others unprotected.

Is password protection the same as encryption?

When you use "Encrypt with Password" in Excel, the file is both password protected and encrypted — meaning the data inside is scrambled and unreadable without the password. Sheet protection is different — it just locks cells but does not encrypt the file contents.