I'm creating a script that copy-paste a sheet. The copied sheet is protected for everyone (except me the owner). When the user click on the button, the script runs and copy-paste my main sheet, the script set a protection to all users, except himself and me (the owner). Here is a part of the script so you can understand :
function protect(){
var s = SpreadsheetApp.getActive();
var copy = s.getSheetByName('BEI-').copyTo(s);
var newsheet = copy.setName(NouvDem);
var SheetToProtect=s.getSheetByName(NouvDem).activate();
SheetToProtect.protect();
var AllProtections = SheetToProtect.getProtections(SpreadsheetApp.ProtectionType.SHEET);
var MyProtection = AllProtections[0];
var Users = MyProtection.getEditors();
MyProtection.removeEditors(Users);
}
How to protect the new sheet from himself (so he can only uses scripts to modify the sheet) ?
Thank you ! :)