Overview
Locking an Excel spreadsheet can mean several different things depending on your goal. You might want to protect a worksheet to prevent edits while keeping specific cells editable for data entry, protect the workbook structure to prevent adding or deleting sheets, encrypt the file with a password to restrict who can open it, or simply distribute the file as read-only. The most common choice is worksheet protection using the Protect Sheet command on the Review tab, which allows you to lock formulas and formatting while optionally leaving input cells editable for users who need to enter data.
Choose the right way to lock an Excel spreadsheet
Excel offers multiple protection methods, each suited to a different goal. The decision matrix below maps your intended outcome to the right feature:
| Your Goal | Excel Feature | What It Prevents | What Still Works | Best For |
|---|---|---|---|---|
| Prevent accidental edits to a worksheet | Protect Sheet | Editing, formatting, inserting rows/columns | Entering data in unlocked cells, viewing all content | Templates, formulas, shared workbooks |
| Lock formulas but allow data entry | Locked cells + Protect Sheet | Editing locked cells only | Entering data in unlocked cells, sorting, filtering | Budget templates, data-entry forms |
| Prevent adding, deleting, or hiding sheets | Protect Workbook (Structure) | Sheet operations | Editing sheet content, data entry | Multi-sheet financial models, fixed workbook layouts |
| Require a password to open the file | Encrypt with Password | File access | All editing and viewing (after password entry) | Confidential data, sensitive files |
| Discourage overwrites without strong restrictions | Read-only mode or flag | Accidental saves to original file | Viewing, entering data, editing (if resaved) | Shared reports, review copies |
Use Protect Sheet to stop worksheet edits
Worksheet protection is the standard approach when you want to prevent users from changing a worksheet’s structure, formulas, or formatting. When you turn on Protect Sheet, all cells are locked by default, but you can unlock specific cells beforehand so users can still enter data where needed. The protection applies only to that single sheet—other sheets in the workbook remain unprotected unless you protect them separately.
Protect Sheet allows granular control over what users can do. You can choose to allow sorting and filtering, inserting or deleting rows, or other specific actions while still blocking edits to locked cells. A password is optional; without one, anyone can turn off the protection, but with a password, only someone who knows it can disable the protection.
Use locked and unlocked cells to protect formulas but allow input
Excel does not allow a cell to be locked without turning on worksheet protection. The “Locked” property is built into every cell by default, but it only takes effect once you enable Protect Sheet. This two-step process is why many users are confused: setting a cell to Locked does nothing until the worksheet itself is protected.
To lock formulas while allowing data entry, you must first unlock the cells where users should be able to type, then protect the sheet. This means selecting your input range, opening the Format Cells dialog, and clearing the Locked checkbox before enabling Protect Sheet. Any cells you don’t explicitly unlock will remain locked and protected.
Use Protect Workbook to protect workbook structure
Workbook structure protection prevents users from adding new sheets, deleting existing sheets, moving sheets, hiding sheets, or renaming sheets. This is useful for preserving the layout of a multi-sheet financial model or ensuring that all required report tabs remain visible. Unlike worksheet protection, structure protection applies to the entire workbook, not individual sheets.
Structure protection does not prevent editing the content of existing sheets—only the sheet operations themselves. Users can still enter data, edit formulas, and work within the existing sheet structure if worksheet protection is not also enabled on individual sheets.
Use Encrypt with Password to restrict opening the file
File-level encryption using Encrypt with Password requires a password to open the file at all. This is fundamentally different from worksheet protection: it’s about access, not editing. Once someone enters the correct password and opens the file, they can edit it freely unless worksheet protection is also enabled.
Encryption is appropriate when the file contains confidential data and you need to prevent unauthorized access. It is not appropriate for casual tamper-resistance or for preventing accidental edits within a team—worksheet protection is better for those goals. Be aware that if the password is lost, the file is permanently inaccessible; Excel has no recovery mechanism for forgotten encryption passwords.
How to lock an entire worksheet in Excel
Protect a worksheet in Excel for Windows
- Click the sheet tab for the worksheet you want to protect.
- Click the Review tab on the ribbon.
- Click Protect Sheet.
- In the dialog, enter a password if you want one (optional).
- Optionally, check or uncheck specific actions in the “Allow all users of this worksheet to” list—for example, check Select locked cells and Sort if you want users to be able to sort data, or leave Insert rows checked if users need to add rows to a growing dataset.
- Click OK and re-enter your password to confirm.
The sheet is now protected. Locked cells cannot be edited, but any cells you unlocked beforehand remain editable.
Protect a worksheet in Excel for the web
In Excel for the web, open the worksheet you want to protect and click the Review tab. Select Manage Protection (or a similar option depending on your Microsoft 365 version) and follow the dialog prompts to set a password and choose allowed actions. The process is similar to the desktop version, though the exact wording and menu paths may vary slightly.
How to lock formulas but leave input cells editable
Worked example: protect a small budget template
Imagine you have a simple budget template with the following layout:
| Cell | Content | Type |
|---|---|---|
| B1 | “Budget” | Label |
| B2 | 50000 | Input (user enters budgeted amount) |
| B3 | “Actual” | Label |
| B4 | 45000 | Input (user enters actual amount) |
| B5 | “Remaining” | Label |
| B6 | =B2-B4 | Formula (locked to prevent changes) |
Your goal is to let users enter values in B2 and B4 but prevent them from changing the formula in B6 or the labels.
Step 1: Unlock the input cells. Select cells B2 and B4 (hold Ctrl and click each). Right-click and choose Format Cells, or press Ctrl+1 on Windows. Go to the Protection tab, uncheck Locked, and click OK. These cells are now marked as unlocked.
Step 2: Protect the sheet. Go to the Review tab and click Protect Sheet. The formula cells and labels (B1, B3, B5, B6) remain locked because you only unlocked B2 and B4. Set a password if desired, click OK, and confirm the password. Users can now edit B2 and B4 but cannot modify B6 or any other locked cell.
Result: Users see an error message if they try to edit a locked cell, but they can freely enter or change the budget and actual amounts in B2 and B4. The formula updates automatically as they type.
Allow sorting, filtering, and other needed actions
By default, Protect Sheet disables many common actions like sorting, filtering, inserting rows, and deleting rows. If your users need to perform these actions, you must explicitly allow them in the protection dialog. When you click Protect Sheet, look for the “Allow all users of this worksheet to” section and check the boxes for:
- Sort if you want users to sort the data
- Use AutoFilter if you want users to filter columns
- Insert rows or Delete rows if your data table needs to grow or shrink over time
- Edit objects if the sheet contains shapes, images, or comments that users should be able to modify
Failing to check these boxes is a common mistake—users become frustrated when their normal workflows (like sorting a report or filtering a table) suddenly stop working after protection is enabled. Test the sheet after protection to verify that all necessary actions still work.
How to password protect an Excel file
When file encryption is the better fit
Use Encrypt with Password when the goal is to prevent unauthorized access to the file itself, not just to prevent accidental edits. This is appropriate for files containing sensitive personal data, financial information, trade secrets, or other confidential content that should not be viewed by someone without authorization.
File encryption is not appropriate for casual edit prevention. If your goal is to discourage accidental overwrites or preserve formulas in a shared workbook, worksheet protection is faster to set up, easier to manage (passwords can be removed or changed), and less risky (there is no password loss problem).
What to know before using a password
To encrypt a file with a password:
- Open the workbook you want to protect.
- Click File > Info.
- Click the Protect Workbook box and select Encrypt with Password.
- Enter a password and click OK.
- Re-enter the password to confirm.
The file is now encrypted. Anyone who opens it will be prompted for the password before the file can be accessed.
Password management: If you use encryption, you must store the password securely and document who has access to it. If the password is lost, the file is permanently inaccessible—there is no recovery process in native Excel. For shared files, document password ownership and storage so that if the primary password holder leaves the organization, the password can be handed off or changed by an authorized administrator before access is locked out.
Interoperability: Some older versions of Excel or alternative spreadsheet applications may not support modern Excel encryption formats. Test the encrypted file in the software versions your users will actually use before rolling it out.
How to make an Excel spreadsheet read-only
A lighter alternative to worksheet protection is distributing the file as read-only. You can save a file as read-only by opening File > Save As, choosing your file format, and checking the Read-only recommended option before saving. When users open the file, they see a prompt encouraging them to open it in read-only mode, but they can still choose to enable editing if they need to make changes.
Read-only mode is useful when you want to discourage accidental overwrites of a shared report or review copy without applying granular protection. Users can still view and explore the data, but the initial prompt reminds them that the file is not meant to be changed. Unlike worksheet protection, read-only mode applies to the entire file and does not require a password.
Locking Excel spreadsheets for sharing and collaboration
Excel protection is not the same as sharing permissions
A common confusion: turning on Protect Sheet does not control who can access the file. Worksheet protection only controls what users can do after they have opened the file. If you want to restrict access by user—for example, allowing only certain team members to open a file at all—you need to rely on file-system permissions, cloud storage sharing settings (OneDrive, SharePoint), or email controls, not on Excel’s built-in protection features.
In a collaboration environment, use Excel protection for edit control (preventing accidental changes) and use your file-sharing platform’s permission model for access control (who can open the file). The two work together: you can encrypt a file with a password and also restrict sharing permissions so only authorized people get the password. Mixing protection and permissions correctly prevents both unauthorized access and unintended edits.
Test the file before you send it
Before distributing a locked or encrypted spreadsheet, verify that all required workflows still work:
- Open the file and try entering data in the cells that should be editable.
- Try editing a locked cell to confirm you get an error message.
- If sorting or filtering is needed, try those actions to verify they work.
- If the file is encrypted, open it in another session or on another computer to confirm the password works.
- If users will need to insert rows or delete rows, try those actions.
- Try unprotecting the sheet using the password you set, to confirm it works.
A few minutes of testing before sharing prevents frustration and reduces support requests from users whose normal workflows are broken by overly restrictive protection settings.
Troubleshooting locked Excel spreadsheets
Cells are still editable after locking them
You locked cells but they are still editable, even though you expected them to be protected. The cause is almost always that you set the Locked property on the cells but never turned on Protect Sheet. The Locked property does nothing by itself—it only takes effect once worksheet protection is enabled. Solution: Go to the Review tab and click Protect Sheet to turn on protection. Now the locked cells will be truly locked.
Users cannot type in the cells they need
Users are trying to enter data in specific cells but get an error message saying the cell is protected. This means you did not unlock those cells before turning on Protect Sheet. Solution: Go to the Review tab and click Unprotect Sheet (or “Manage Protection” in some Excel versions). Enter the password if one was set. Select the cells that should be editable, right-click, choose Format Cells, go to the Protection tab, uncheck Locked, and click OK. Then re-enable Protect Sheet and re-enter your password. Now those cells will be editable.
Sorting or filtering stopped working
You turned on Protect Sheet and now users cannot sort data or use AutoFilter. You did not enable those actions in the Protect Sheet dialog. Solution: Unprotect the sheet using the password, go to Review > Protect Sheet, check the boxes for Sort and Use AutoFilter in the “Allow all users of this worksheet to” list, and re-protect the sheet. Users can now sort and filter again.
The password is lost or no one knows who owns it
Someone set a password on a protected sheet or encrypted file, and the password is now lost or unknown. Unfortunately, there is no built-in password recovery in Excel. For worksheet protection, the password can sometimes be reset by advanced users using workarounds, but those methods are not reliable and do not work on all file types. For file-level encryption (Encrypt with Password), the file is permanently inaccessible without the correct password.
Prevention: For any protected or encrypted file that will be shared or maintained beyond the original creator, document the password, store it securely (password manager, encrypted note, or vault), and assign clear ownership so password changes can be managed if the original creator leaves the organization.
When not to lock an Excel spreadsheet
If your goal is to share data for exploration and discovery rather than controlled editing, locking may be unnecessary. Consider these alternatives:
- Distribution copies: Export the data to a new file and distribute the copy as read-only. The original stays protected and locked; users get a copy they can explore freely.
- PDF or static export: If users only need to view and review the data without editing, a PDF or static HTML export prevents accidental changes entirely.
- Interactive dataset pages: For research datasets or public data intended for broad exploration, publishing the data as an interactive web page with charts, tables, and filters can be more effective than sharing a locked Excel file. Tools like TablePage let you upload an XLSX file and instantly generate a shareable interactive page with charts, insights, and a filterable table—no signup needed. This approach removes the friction of password management and protection settings while giving users a clean, explorable interface.
- Cloud-based collaboration: If your team needs to work together on a live spreadsheet, cloud storage services like OneDrive or SharePoint with co-authoring may be better than locking a static file. Collaboration features and version history can replace the need for cell-level protection.
Choose the method that best fits your audience and intended use. Locking is not always the simplest solution.
Frequently asked questions
Can I lock an Excel spreadsheet without a password?
Yes. Both Protect Sheet and Encrypt with Password support optional passwords. You can turn on worksheet protection without setting a password—anyone can then unprotect the sheet, but the protection still serves as a reminder that the file is meant to be preserved as-is. Passwords provide true access control; without a password, protection is mainly a safeguard against accidental changes.
Does protecting a worksheet encrypt the Excel file?
No. Worksheet protection (Protect Sheet) only controls editing within the sheet—it does not encrypt the file itself. The file content is still readable and can be opened by anyone with the file. If you want to encrypt the file and require a password to open it, use File > Info > Protect Workbook > Encrypt with Password. Worksheet protection and file encryption are separate features that can be used together or independently.
Can I lock only one sheet in a workbook?
Yes. Worksheet protection applies to individual sheets. You can protect some sheets and leave others unprotected, or protect each sheet with a different password. To protect workbook structure (prevent adding, deleting, or moving sheets) separately from worksheet content, use Protect Workbook > Protect workbook structure instead of Protect Sheet. You can use both: protect the workbook structure to lock down the sheet tabs and protect individual sheets to control editing within each sheet.
How do I unlock a protected Excel spreadsheet?
Go to the Review tab and click Unprotect Sheet (or a similar option like Manage Protection in some versions). If a password was set, you will be prompted to enter it. Once you enter the password correctly, the sheet is unprotected and users can edit all cells again. If you encrypted the file with Encrypt with Password and want to remove the encryption, open File > Info, click Protect Workbook, and select Encrypt with Password again—leave the password field empty and click OK to remove the encryption.