I have created 50 spreadsheets for 50 students. Each spreadsheet contains 33 sheets, numbered 1 to 33, along with a couple of other sheets. Within each of these 33 sheets, there are many protected ranges. I accidentally protected a range that ought not to have been protected. So, with 50 students each having 33 sheets, I have over 1800 sheets to unprotected.
I want to loop through each sheet, 1 to 33, and remove protection from cell F15. Right now, I (the owner) am the only editor. Since I'm not an actual programmer, I've clearly not done this properly. Can someone offer a suggestion of how I can change my Google Script to make this work?
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
for (var i=2; i <sheets.length; i++) {
var sheet = ss.getSheets()[i];
sheet.activate();
SpreadsheetApp.flush();
var range = sheet.getRange('F15');
var protection = range.protect().setDescription('Protected range');
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
protection.remove();
} //end of if statement
}