Protect an Excel file

Protect an Excel file
You can protect your Excel file with a password to prevent others from accessing data in your Excel
files. This topic covers the two different ways you can protect an Excel file — using encryption, and
the setting a password to open/modify an Excel file.
Notes: This topic covers file-level protection only, and not workbook or worksheet protection.



For information on workbook protection, see Protect a workbook.
For information on worksheet protection, see Protect a worksheet.
To know the difference between protecting your Excel file, workbook, or a worksheet, see
Protection and security in Excel.
Warning:



Microsoft can’t retrieve forgotten passwords.
There are no restrictions on the passwords you use with regards to length, characters or
numbers, but passwords are case-sensitive.
It’s not always secure to distribute password-protected files that contain sensitive information
such as credit card numbers.
Be cautious when sharing files or passwords with other users. You still run the risk of
passwords them falling into the hands of unintended users. Remember that locking a file with
a password does not necessarily protect your file from malicious intent.
Encrypt an Excel file
When you encrypt an Excel file, you lock it with a password. Once you encrypt an Excel file, no one
else will be able to open it. This is the most common and recommended technique to lock an Excel
file.
Follow these steps to encrypt an Excel file:
1. Click File > Info > Protect Workbook > Encrypt with Password .
2. Enter a password, and click OK.
3. In the Confirm Password dialog box, reenter the password you entered in the previous step.
When you/another user tries to open the file, the following screen appears:
Set a password to allow reading or modifying
You can set two passwords on the file - one to open the file as read-only, and the other to modify.
Then you can share the appropriate passwords with the users depending on the access level they
should have.
Read-only access does not prevent someone from making changes to a file, but it does prevent them
from saving those changes unless they rename the file and save it as something other than the
original.
For users who need to be able to modify the file, you will have to share both open and modify
passwords.
Follow these steps to set a password to open/modify an Excel file:
Note: In the Mac, go to File > Save As > Options, and then set the password to open or modify the
file. Select Read Only if you want users to open the file as Read-only.
1. In the Excel file, click File > Save As.
2. Click a location, such as Computer or your My Site web page.
3. Click a folder, such as Documents or one of the folders on your OneDrive, or click Browse.
4. In the Save As dialog box, go to the folder you want to use, then click Tools and then click
General Options.
5. You can specify one or both passwords here, one to open the file, another to modify the file,
depending on your requirements.
6. Click Save.
When someone tries to open this file, Excel prompts for a password.
A second screen shows if there is a password to modify the file. Users who don’t have the modify
password can click Read Only and start viewing the contents of the file.
How can I tell if a file is protected?
Click File > Info > Protect Workbook to see this protection status.
Disable encryption in an Excel file
1.
2.
In your Excel file, click File > Info > Protect Workbook, and then click Encrypt with Password.
Delete the password and click OK.
Remove passwords
You can change or remove passwords that are set for opening/modifying an Excel file, by
following the same procedure as setting the passwords.
Simply delete the password you set in the General Options box.
Known issue: Passwords disappear when you save
an Excel file to the Excel 97-2003 (*.xls) format
You want to share your password-protected workbook with users who use Office Excel
2003 (the default file format is Excel 97-2003 (*.xls)). You saved the workbook to the
*.xls format, but the password you set on the workbook has disappeared.
This happens because your version of Excel uses a new scheme for saving passwords,
and the earlier file format doesn't recognize it. As a result, the password is discarded
when you save your file to the Excel 97-2003 format.
To resolve this issue, set the password again in the *.xls file.
Protect a worksheet
To prevent other users from accidentally or deliberately changing, moving, or deleting data in a
worksheet, you can lock the cells on your Excel worksheet and then protect the sheet with a
password. Say you own the team status report worksheet, where you want team members to add
data in specific cells only and not be able to modify anything else. With worksheet protection, you can
make only certain parts of the sheet editable and users will not be able to modify data in any other
region in the sheet.
Important: Protecting a worksheet is not the same as protecting an Excel file or a workbook with a
password. See below for more information:



To lock your file so that other users can’t open it, see Protect an Excel file.
To prevent users from adding, modifying, moving, copying, or hiding/unhiding sheets within a
workbook, see Protect a workbook.
To know the difference between protecting your Excel file, workbook, or a worksheet see
Protection and security in Excel.
Choose what cell elements you want to lock
Here's what you can lock in an unprotected sheet:


Formulas: If you don’t want other users to see your formulas, you can hide them from being
seen in cells or the Formula bar. For more information, see Hide and protect formulas.
Ranges: You can enable users to work in specific ranges within a protected sheet. For more
information, see Lock or unlock specific areas of a protected worksheet.
Note: ActiveX controls, form controls, shapes, charts, SmartArt, Sparklines, Slicers, Timelines, to name
a few, are already locked when you add them to a spreadsheet. But the lock will work only when you
enable sheet protection. See the subsequent section for more information on how to enable sheet
protection.
Enable worksheet protection
Worksheet protection is a two-step process: the first step is to unlock cells that others can edit, and
then you can protect the worksheet with or without a password.
Step 1: Unlock any cells that needs to be editable
1. In your Excel file, select the worksheet tab that you want to protect.
2. Select the cells that others can edit.
Tip: You can select multiple, non-contiguous cells by pressing Ctrl+Left-Click.
3. Right-click anywhere in the sheet and select Format Cells (or use Ctrl+1, or Command+1 on
the Mac), and then go to the Protection tab and clear Locked.
Step 2: Protect the worksheet
Next, select the actions that users should be allowed to take on the sheet, such as insert or delete
columns or rows, edit objects, sort, or use AutoFilter, to name a few. Additionally, you can also specify
a password to lock your worksheet. A password prevents other people from removing the worksheet
protection—it needs to be entered to unprotect the sheet.
Given below are the steps to protect your sheet.
1.
On the Review tab, click Protect Sheet.
2. In the Allow all users of this worksheet to list, select the elements you want people to be able
to change.
Option
Allows users to
Move the pointer to cells for which the Locked box is checked on the
Select
Protection tab of the Format Cells dialog box. By default, users are allowed to
locked cells
select locked cells.
Select
unlocked
cells
Move the pointer to cells for which the Locked box is unchecked on the
Protection tab of the Format Cells dialog box. By default, users can select
unlocked cells, and they can press the TAB key to move between the unlocked
cells on a protected worksheet.
Change any of the options in the Format Cells or Conditional Formatting dialog
boxes. If you applied conditional formatting before you protected the
Format cells
worksheet, the formatting continues to change when a user enters a value that
satisfies a different condition.
Format
columns
Use any of the column formatting commands, including changing column
width or hiding columns (Home tab, Cells group, Format button).
Format rows
Use any of the row formatting commands, including changing row height or
hiding rows (Home tab, Cells group, Format button).
Insert
columns
Insert columns.
Insert rows
Insert rows.
Insert
hyperlinks
Insert new hyperlinks, even in unlocked cells.
Delete
columns
Delete columns.
Option
Allows users to
Note: If Delete columns is protected and Insert columns is not protected, a user
can insert columns but cannot delete them.
Delete rows.
Delete rows
Note: If Delete rows is protected and Insert rows is not protected, a user can
insert rows but cannot delete them.
Use any commands to sort data (Data tab, Sort & Filter group).
Sort
Use
AutoFilter
Use
PivotTable
reports
Note: Users can't sort ranges that contain locked cells on a protected
worksheet, regardless of this setting.
Use the drop-down arrows to change the filter on ranges when AutoFilters are
applied.
Note: Users cannot apply or remove AutoFilter on a protected worksheet,
regardless of this setting.
Format, change the layout, refresh, or otherwise modify PivotTable reports, or
create new reports.
Doing any of the following:
o
Edit objects
o
o
Edit
scenarios
Make changes to graphic objects including maps, embedded charts,
shapes, text boxes, and controls that you did not unlock before you
protected the worksheet. For example, if a worksheet has a button that
runs a macro, you can click the button to run the macro, but you
cannot delete the button.
Make any changes, such as formatting, to an embedded chart. The
chart continues to be updated when you change its source data.
Add or edit comments.
View scenarios that you have hidden, making changes to scenarios that you
have prevented changes to, and deleting these scenarios. Users can change
the values in the changing cells, if the cells are not protected, and add new
scenarios.
3. Optionally, enter a password in the Password to unprotect sheet box and click OK. Reenter
the password in the Confirm Password dialog box and click OK.
Important: Use strong passwords that combine uppercase and lowercase letters, numbers,
and symbols. Weak passwords don't mix these elements. Passwords should be 8 or more
characters in length. A passphrase that uses 14 or more characters is better.
It is critical that you remember your password. If you forget your password, Microsoft cannot
retrieve it.
How can I tell if a sheet is protected?
The Protect Sheet option on the ribbon changes to Unprotect Sheet when a sheet is
protected. To view this option, click the Review tab on the ribbon, and in Changes, see
Unprotect Sheet.
In an unprotected sheet, the Protect Sheet option displays on the ribbon
In a protected sheet, Protect Sheet changes to Unprotect Sheet
Unprotect an Excel worksheet
To unprotect a sheet, follow these steps:
1.
2.
3.
Go to the worksheet you want to unprotect.
Go to File > Info > Protect > Unprotect Sheet, or from the Review tab > Changes > Unprotect Sheet.
If the sheet is protected with a password, then enter the password in the Unprotect Sheet dialog box, and click OK.