Sheet or Range Protection

 I created a sheet and apply sheet protection using the app script but the code not working. the code is given below.

 
function removeEditor() {
  let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
  let protect = sheet.protect()
  let email ="User Email"
  protect.removeEditor(email);
  if(protect.canDomainEdit()){
    protect.setDomainEdit(false)
  }
}
sheet protection not working properly? or created the wrong code . please Suggest.
1 0 112
0 REPLIES 0