We've been trying random solutions for the past couple of weeks that we have found on here and other sites.. came close a couple of times but still no bueno. Scenario: We have a worksheet that will have multiple sheets, one in which they will edit and the others we want protected. This is an invoice/quote builder, so every time they have a new one they will be making a copy of the main. Obviously protection doesn't carry over so we are trying to use Script Editor to remove all users except for me and one other. I couldn't get onOpen() to work so I am just adding a button into the menu that they will have to click (we trust them to do this each time), that will run a function, here's where we are at:function onOpen() {      var ui = SpreadsheetApp.getUi();      ui.createMenu('Custom Menu')          .addItem('First item', 'testProtect')          .addToUi();}function testProtect(){      var sheet = SpreadsheetApp.getActiveSheet();      var protection = sheet.protect().setDescription('Test');      protection.removeEditor(example1@domain.com);      protection.removeEditor(example2@domain.com);      protection.addEditor(example3@domain.com);      var ui = SpreadsheetApp.getUi();      ui.alert(Permissions Set);}Function runs and will do everything EXCEPT remove the user that is the one in there running it. I have tried getting the active user and removing them that way as well as throwing in their exact email (we only have 8 employees who might touch this, so i'm fine with adding/removing each line by line if I had to). Thanks for any help or suggestions, aside from this working we will just have to trust they don't touch anything they aren't supposed to Lol but we know how that goes sometimes...
Script to add protection and remove the user running it?
google spreadsheets;google apps;google apps script