from ironxl import * # Load the Excel workbook workbook = WorkBook.Load("sample.xlsx") worksheet = workbook.DefaultWorkSheet # Open a protected spreadsheet file protected_workbook = WorkBook.Load("sample.xlsx", "IronSoftware") # Spreadsheet protection # Set protection for the spreadsheet file workbook.Encrypt("IronSoftware") # Remove protection for the spreadsheet file. Original password is not required. workbook.Password = None workbook.Save() # Worksheet protection # Set protection for an individual worksheet worksheet.ProtectSheet("IronXL") # Remove protection for a particular worksheet. It works without a password! worksheet.UnprotectSheet() workbook.Save()