XLSX

Sheet Protection

Lock worksheets to restrict editing

Protecting a Worksheet

Protect a worksheet with a password and restrict user actions:

{
  "worksheets": [
    {
      "name": "Protected",
      "rows": [
        { "cells": [{ "value": "Quarter" }, { "value": "2023" }, { "value": "2024" }] },
        { "cells": [{ "value": "Q1" }, { "value": 100 }, { "value": 120 }] },
        { "cells": [{ "value": "Q2" }, { "value": 150 }, { "value": 170 }] }
      ],
      "protection": {
        "sheet": true,
        "password": "secret",
        "formatCells": false,
        "insertRows": false,
        "sort": false
      }
    }
  ]
}

Protection Options Reference

OptionTypeDescription
sheetbooleanEnable sheet protection
passwordstringProtection password
objectsbooleanProtect objects
scenariosbooleanProtect scenarios
formatCellsbooleanAllow formatting cells
formatColumnsbooleanAllow formatting columns
formatRowsbooleanAllow formatting rows
insertColumnsbooleanAllow inserting columns
insertRowsbooleanAllow inserting rows
insertHyperlinksbooleanAllow inserting hyperlinks
deleteColumnsbooleanAllow deleting columns
deleteRowsbooleanAllow deleting rows
selectLockedCellsbooleanAllow selecting locked cells
sortbooleanAllow sorting
autoFilterbooleanAllow auto filter
pivotTablesbooleanAllow pivot tables
selectUnlockedCellsbooleanAllow selecting unlocked cells
Copyright © 2026