Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

How can I use the onEdit() trigger to timestamp a cell if another cell in the same row is checked "TRUE" in apps script?

$
0
0

I am able to add a timestamp in column 5 using a conditional when I'm comparing the column to a number, but what I am actually trying to do is add a stamp to the corresponding cell in column 5 if a cell in column 1 is checked as TRUE. When the box is checked, the corresponding cell in column 5 never displays the timestamp:

function onEdit(e) {  var attendanceSheet = e.source.getActiveSheet();  var row = e.range.getRow();  var col = e.range.getColumn();  if(col === true){    attendanceSheet.getRange(row,5).setValue(new Date());      }  else{    attendanceSheet.getRange(row,5).setValue("");  }}

enter image description here


Viewing all articles
Browse latest Browse all 9782

Trending Articles