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

Google Sheet Script for automatically entering date/time stamp when the adjacent column

$
0
0

I've found a script on here for entering a timestamp in a column based on edits to the adjacent column:Date and time stamp automatically added in column

  if(e.source.getActiveSheet().getName() == "Sheet1" ) {    var col = e.source.getActiveCell().getColumn();    if(col == 1 || col == 4) {      var nCell = e.range.offset(0,1);         if(nCell.getValue() == "" && e.value != "") {        var time = Utilities.formatDate(new Date(), "GMT+1", "HH:mm:ss");        nCell.setValue(time);      } else if(nCell.getValue() != "" && e.value == "") {         nCell.setValue("");      }    }  }    }

I can only get it to enter the time or the date not both. What am I missing? I need to have a timestamp auto entered after we enter completed in the previous cell before the document is transferred to our historical tab.


Viewing all articles
Browse latest Browse all 9788

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>