1Excel.run(function (context) {
2 var activeSheet = context.workbook.worksheets.getActiveWorksheet();
3 activeSheet.load("protection/protected");
4
5 return context.sync().then(function() {
6 if (!activeSheet.protection.protected) {
7 activeSheet.protection.protect();
8 }
9 })
10}).catch(errorHandlerFunction);
11