openpyxl.worksheet.protection module

class openpyxl.worksheet.protection.SheetProtection(sheet=False, objects=False, scenarios=False, formatCells=True, formatRows=True, formatColumns=True, insertColumns=True, insertRows=True, insertHyperlinks=True, deleteColumns=True, deleteRows=True, selectLockedCells=False, selectUnlockedCells=False, sort=True, autoFilter=True, pivotTables=True, password=None, algorithmName=None, saltValue=None, spinCount=None, hashValue=None)[source]

Bases: Serialisable, _Protected

Information about protection of various aspects of a sheet. True values mean that protection for the object or action is active This is the default when protection is active, ie. users cannot do something

algorithmName

Values must be of type <class ‘str’>

autoFilter

Values must be of type <class ‘bool’>

deleteColumns

Values must be of type <class ‘bool’>

deleteRows

Values must be of type <class ‘bool’>

disable()[source]
enable()[source]
enabled

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

formatCells

Values must be of type <class ‘bool’>

formatColumns

Values must be of type <class ‘bool’>

formatRows

Values must be of type <class ‘bool’>

hashValue
insertColumns

Values must be of type <class ‘bool’>

Values must be of type <class ‘bool’>

insertRows

Values must be of type <class ‘bool’>

objects

Values must be of type <class ‘bool’>

pivotTables

Values must be of type <class ‘bool’>

saltValue
scenarios

Values must be of type <class ‘bool’>

selectLockedCells

Values must be of type <class ‘bool’>

selectUnlockedCells

Values must be of type <class ‘bool’>

set_password(value='', already_hashed=False)[source]

Set a password on this sheet.

sheet

Values must be of type <class ‘bool’>

sort

Values must be of type <class ‘bool’>

spinCount

Values must be of type <class ‘int’>

tagname = 'sheetProtection'