Lock the entire row after checkbox become true

56 views
Skip to first unread message

Suresh_ Kumar_J

unread,
Oct 5, 2022, 12:20:39 PM10/5/22
to Google Apps Script Community
hi all, 

I am trying to create new user id creation in apps script. I am getting data from google sheets and HR team will fill it. So, I want to lock the entire row once they finish the details filling and should not be edited without owner permissions. 
I tried this code:
function onEdit(e) {
  const sh =SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  if(e.range.columnStart !=4) return;
  let protection = sh.getRange(e.range.rowStart,1,1,sh.getMaxColumns()).protect();
  protection.removeEditors(protection.getEditors());
  if(protection.canDomainEdit()){
    protection.setDomainEdit(false);
    
  }
}

this protects the owner entered data but not the editor entered data. I want to lock the entire row once the editor finished and after checkbox true


Thanks in advance.
Reply all
Reply to author
Forward
0 new messages