0

I have the following OnEdit script in a Google spreadsheet that inserts a timestamp when a checkbox is edited. The action is preformed when I make the edit, but does not work when the edit is made by another user. Any help is appreciated.

function onEdit(e) {
  
  addTimestamp(e);
  
}
  

function addTimestamp(e){
  //variables
  var startRow = 3;
  var targetColumn = 6;
  var ws = "MasterList";
  
  //get modified row and column
  var row = e.range.getRow();
  var col = e. range.getColumn();
  
  if(col === targetColumn && row >= startRow && e.source.getActiveSheet().getName() === ws){
    e.source.getActiveSheet().getRange(row,19).setValue(new Date());
  }  
}
  • Do the other users have writing/editing permissions on the file and in particular in the cell that the timestamp is saved and in the cell that is edited? – Marios Aug 13 '20 at 15:22
  • 1
    check also this post for reference: https://stackoverflow.com/questions/26317723/google-spreadsheet-gas-trigger-not-firing-for-anonymous-editors – Marios Aug 13 '20 at 15:26
  • Please add more details: Is there an message logged in the script execution page? How do you shared the spreadsheet with the other users? Do your script contains something besides what was included in this question? – Rubén Aug 13 '20 at 17:59

2 Answers2

0

I have seen several cases having problems using chaining with active methods that might be difficult to reproduce.

Try replacing

e.source.getActiveSheet().getName()

by

e.range.getSheet().getName()

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166
-1

The onEdit() function will run whenever the spreadsheet is edited. And you can check any failures under Tools > Script editor > View > Executions.

The reason that it fails to work under shared users editing is those users do not have permission to edit the target cell. It means you had set the protection of the cell.

CGS
  • 1