Can I lock a particular Google Apps worksheet using a script?
google-apps-script
Solution
// Enables sheet protection for this sheet
var sheet = SpreadsheetApp.getActiveSheet();
var permissions = sheet.getSheetProtection();
permissions.setProtected(true);
sheet.setSheetProtection(permissions);
See Spreadsheet Services - Class PageProtection
Problem
Is there a way to lock a particular Google Apps worksheet using a script? I have this code that renames the current spreadsheet to whatever you enter in the input box. ``` // The code below will rename the active sheet to what you enter in the input box var myValue = Browser.inputBox("Enter: LastMonth - Year"); SpreadsheetApp.getActiveSpreadsheet().renameActiveSheet(myValue); SpreadsheetApp.getActiveSpreadsheet().getRange("A1").setValue(myValue); ``` What can I add to the code above that will lock that same worksheet i just renamed only allowing me to edit that worksheet. Is that possible?