Python XLWT - How to protect an excel workbook to make it non-editable?

Viewed 78

I am using XLWT to generate xls files and I would like to protect the workbook structure so that the sheets can't be renamed/deleted/moved and to prevent addition of new sheets.

I used the below to protect the workbook. I see an option to set password for worksheets but NOT for workbook.

workbook.protect = True
workbook.wnd_protect = True
workbook.obj_protect = True
workbook.save("workbook7dg56e38.xls")

The above options did generate a protected workbook but after opening the generated file in Excel I was able to use the "Protect Workbook" option in Excel to override it i.e. I was able to enter and set a password and use the same to unprotect the workbook and delete the sheets. Is there a way in XLWT to disable workbook edits?

enter image description here

enter image description here

0 Answers
Related