XLSX → locked sheets, in one pass

Protect Excel Sheets

Protect several sheets of a workbook with the same password and the same list of allowed actions, and lock the workbook's structure so sheets cannot be added, moved or deleted. Choose the SHA-512 password hash that current Excel writes, the old 16-bit one, or both.

Workbook

An .xlsx or .xlsm up to 50 MB. Only the protection elements change; macros, styles and charts are copied untouched.

Drop your workbook here or click to choose

.xlsx or .xlsm

Settings

Choose a workbook to set up protection.

Protect Excel Sheets

Operator: Abdulla Al Fahad. How tools are built and checked

Sending a budget model with twelve sheets means opening Protect Sheet twelve times, typing the same password twelve times and ticking the same boxes each time. Doing it once for every sheet you choose, together with a lock on the workbook structure, is the whole job here.

Where Unprotect Excel Sheet here removes protection, this tool adds it. It edits the XML of the file directly, so macros, styles, charts and pivot tables are copied through byte for byte, and after saving it reads the new file back to show which password hash each sheet carries.

Key features

  • Tick any of the workbook's worksheets and chart sheets and protect them in one pass
  • The same list of allowed actions, as in Excel's own Protect Sheet dialog, for every ticked sheet
  • Workbook structure protection, with an optional lock on window position and size
  • A choice of SHA-512, the legacy 16-bit hash, or both
  • A read-back of the saved file listing each sheet's protection and hash type

What sheet protection writes into the file

Sheet protection is a sheetProtection element in each sheet's XML. The attribute sheet="1" switches it on, and each allowed action is written the way Excel writes it: formatCells="0" for an allowed action and nothing for a locked one, with objects="1" and scenarios="1" when those are locked. The element is placed where the schema requires, after the sheet data and before auto-filter, merged cells, hyperlinks and the rest, and never inside an AlternateContent block. Chart sheets lock the chart and its objects. Workbook structure protection is a workbookProtection element with lockStructure="1", placed before the book views. The legacy password is a four-digit hex attribute such as password="DAA7", which is the code for "secret" and covers only the first 15 characters. The SHA-512 scheme writes algorithmName, hashValue, saltValue and spinCount="100000": the hash is SHA-512 of a random 16-byte salt followed by the password as UTF-16, then 100,000 further rounds, each hashing the previous result followed by a 4-byte counter, and passwords here are limited to 255 characters, the length Excel's own box accepts. The legacy code for abcdefghij, FEF1, matches the example in the file-format specification, and the SHA-512 value matches ExcelJS's implementation for the same salt.

How it works

The workbook is opened as a ZIP and its current protection is scanned, so each sheet is listed as protected, with which hash, or not protected. You can choose to replace protection on sheets that already have it or leave those sheets as they are.

Each password is hashed once, with its own random salt, and the result is reused for every sheet in the batch, so a twelve-sheet workbook costs the same as one sheet. The 100,000 rounds report progress and can be cancelled. Using one salt per password across sheets leaks nothing beyond what identical passwords already show.

Only the sheet parts and the workbook part that change are rewritten, in the encoding they were read in, and every other part of the archive keeps its original bytes. Dialog and macro sheets are skipped with a reason. The result is saved as the original name with -protected added, keeping the macro-enabled extension when there is one.

Common use cases

  • Locking all 12 sheets of a budget template with one password while still letting people sort and filter, then fixing the sheet order with structure protection.
  • Giving a regional office a model in which only the Inputs sheet stays unprotected: tick the other eleven, leave Inputs unticked.
  • Re-protecting a workbook whose sheets carry an old 16-bit hash: choose replace and SHA-512 so every sheet uses the same current scheme.
  • Sending a macro-enabled template: the .xlsm extension and the VBA project are kept exactly, because only the protection XML is edited.

How to use this tool

  1. Drop the workbook and tick the sheets to protect.
  2. Tick the actions everyone may still do.
  3. Enter a password, or leave it empty, and choose how it is stored.
  4. Switch on structure protection if sheets should not be added, moved or deleted, then press Protect and download.

Example

A workbook with Budget, Notes and an already protected Done sheet

Sheets Budget and Notes ticked, Done ticked but set to leave protected sheets as they are
Password secret, hash both, allowed: format cells, sort, use AutoFilter
Structure locked with password wbpass

Written into the file

Budget and Notes: sheetProtection sheet="1" formatCells="0" sort="0" autoFilter="0" objects="1" scenarios="1" password="DAA7" algorithmName="SHA-512" hashValue=... saltValue=... spinCount="100000"
Done: skipped, already protected, left as it was
Workbook: lockStructure="1" workbookPassword="D81B" with the SHA-512 attributes
The read-back lists Budget and Notes as protected with a SHA-512 hash and a legacy 16-bit hash.

Common pitfalls

Protection is not encryption. The cell values stay readable in the file's XML, and the hash is a flag that Excel and LibreOffice agree to honour. Use Encrypt with Password in Excel when contents must stay private.

Protection acts only on cells whose Locked format is on, which is every cell until changed. To leave input cells editable, unlock them in Excel first with Format Cells, Protection; this page does not change cell formats.

The legacy hash has 65,536 possible values, so many different passwords produce the same code and one can be found at once. Use it only when an old tool needs it.

The password cannot be read back out of the file. If it is lost, Unprotect Sheet here removes the protection without it, which is also why the protection should not be relied on as security.

  • Choose both hashes when the file must also open in a tool that knows only the old scheme; each reader checks the password against the form it understands.
  • Leave a password empty to stop accidents only: Review, Unprotect Sheet then works without a prompt.

Common errors and how to fix them

The page says the workbook is encrypted and cannot be read
Excel wraps a workbook that asks for a password when opened in an encrypted container instead of a ZIP of XML. Clear that password (File, Info, Protect Workbook, Encrypt with Password, delete it), save a copy and choose the copy; sheet protection can then be added here.
"Nothing was changed: every ticked sheet was skipped"
The ticked sheets were already protected and you chose to leave those alone, or they were dialog or macro sheets. Switch the existing-protection choice to replace, or tick other sheets.

Best practices

  • Choose the legacy hash only after confirming that the receiving tool cannot read SHA-512; current Excel and LibreOffice can, and the 16-bit code is far easier to match.
  • Open the saved copy in Excel and try one allowed action and one blocked action on a protected sheet before it goes out.

Sheet protection and workbook structure protection

They guard different things and have separate passwords.

  • Sheet protection stops edits to locked cells and, depending on the ticks, formatting, inserting, deleting, sorting and filtering on that sheet.
  • Structure protection stops adding, deleting, renaming, moving, hiding and unhiding sheets, and with the window option, moving or resizing the workbook window.
  • Neither stops someone copying every cell into a new workbook.

Choosing how the password is stored

The three choices differ in how hard the stored value is to match and in which tools can check it.

  • SHA-512: a salted hash with 100,000 rounds, the form current versions of Excel write.
  • Legacy 16-bit: four hex digits, understood by every version and by many third-party tools.
  • Both: the two forms side by side, so a reader that knows only one can still check the password.