My objective is to protect hundreds of sheets in Google sheets, using the API here.
Only problem is that I can't find a method for protecting the sheet - only adding protected/unprotected ranges?
Solution
Thanks to Cameron; by providing the following batch update with just the sheetId specified, protects a sheet:
const ss = SpreadsheetApp.getActive();
const sheetToProtect = ss.getSheetByName(<name_of_sheet_to_protect>);
Sheets.Spreadsheets.batchUpdate(
{
includeSpreadsheetInResponse: false,
requests: [
{
addProtectedRange: {
protectedRange: {
range: {
sheetId: sheetToProtect.getSheetId(),
},
},
},
},
],
},
ss.getId()
);