0

I was using this Google Sheets script for putting a time stamp on the Google Sheet we use for students to check into different locations of the school. It worked for months, then randomly stopped working. If I input into the Google Sheet cell the timestamp appears, when another editor edits the cell the timestamp doesn't appear.

Why would it stop working?

Here's the script:

function onEdit() {
  var s = SpreadsheetApp.getActiveSheet();
  var r = s.getActiveCell();
  if( r.getColumn() == 2 ) { 
    var nextCell = r.offset(0, -1);
    if( nextCell.getValue() === '' ) 
    nextCell.setValue(new Date());
  }
}
Rubén
  • 34,714
  • 9
  • 70
  • 166
  • 2
    Follow the steps in this thread https://stackoverflow.com/q/11539411/11225291 and then edit your question to show us if you get any error messages. Also use the event object `e` instead of active cells . Tons of threads regarding that. – Marios Mar 16 '21 at 15:33
  • But if your code works for some people it means that the others don't have the right to edit either the input column (column B) or the output column (column A) or both. – Marios Mar 16 '21 at 16:38
  • `when another editor edits the cell the timestamp doesn't appear` Can you check the logs of the corresponding executions? What's their status? Errors displayed? – Iamblichus Mar 17 '21 at 10:22
  • I hadn't changed the protections in the site, but removing the edit protection solved the problem. Thank you! – Benjamin Wagoner Mar 17 '21 at 16:46

0 Answers0