Complete the code to protect the entire sheet named "Data".
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data"); sheet.[1]();
The method protect() is used to protect the entire sheet in Google Sheets scripts.
Complete the code to protect a specific range A1:B10 on the active sheet.
var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange("A1:B10"); var protection = range.[1]();
The protect() method is used on a range object to protect that range.
Fix the error in the code to remove editors from a protected range.
var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange("C1:C5"); var protection = range.protect(); protection.[1]([]);
The method setEditors([]) sets the editors list to empty, effectively removing all editors.
Fill both blanks to protect a range and set a description.
var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange("D1:D10"); var protection = range.[1](); protection.[2]("Confidential Data");
Use protect() to protect the range and setDescription() to add a description.
Fill all three blanks to protect a sheet, set a description, and remove all editors.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Summary"); var protection = sheet.[1](); protection.[2]("Sheet locked for editing"); protection.[3]([]);
Protect the sheet with protect(), add description with setDescription(), and remove editors by setting an empty list with setEditors([]).