using IronXL;
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet worksheet = workbook.DefaultWorkSheet;
//This is how we can protect the worksheet setting the password to it
//Users will then need to know this password to edit the worksheet in Excel.
worksheet.ProtectSheet("password");
workbook.Save();
//This is how to unprotect the worksheet and remove any password locks
//It works even if you do not know the password!
worksheet.UnprotectSheet();
workbook.Save();
Imports IronXL
Private workbook As WorkBook = WorkBook.Load("test.xlsx")
Private worksheet As WorkSheet = workbook.DefaultWorkSheet
'This is how we can protect the worksheet setting the password to it
'Users will then need to know this password to edit the worksheet in Excel.
worksheet.ProtectSheet("password")
workbook.Save()
'This is how to unprotect the worksheet and remove any password locks
'It works even if you do not know the password!
worksheet.UnprotectSheet()
workbook.Save()