I have script to protect cell after data in any cell in range("A:A"), Sheet1 is updated
Firstly, it worked perfectly, but now it does not protect Editor from editing that cell
Now, after data in cell is updated, the script will run to protect cell but it does not remove editor to "View Only". It set permission to allow Editor and Owner to edit cell. The first time, it set permission to only Owner and other Editors are "View Only"
Trigger is the same. It runs when "On Edit"
Problem : Script does not remove editor to "View Only" in protection, it still keeps editor in permission list. Pls kindly help me accordingly.
function protectcell(e) {
var range = e.range;
if (range.getSheet().getName() != "Sheet1") return;
if (range.getWidth() != 1 || range.getHeight() != 1) return;
if (range.getColumn() != 1 || range.getRow() < 2) return;
if (!e.value) return;
var timeZone = Session.getScriptTimeZone();
var stringDate = Utilities.formatDate(new Date(), timeZone, 'dd/MM/yy HH:mm');
var description = 'Protected on ' + stringDate;
var protection = range.protect().setDescription(description);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) protection.setDomainEdit(false);
}