I found this solution to autoinclude the date in a column when another one is modified and it works great. Auto date insert when opposite cell is populated

What Im looking to do is:

  1. To modify this to get it to execute only in one of the sheets of my document.
  2. Even better, have it triggered in different sheets by modifying different columns and including the date also in a different column.

I have tried but not gotten very far... any help would be awesome

Original code:

function onEdit(event) {
  var eventRange = event.range;
  if (eventRange.getColumn() == 4) { // 4 == column D
    var columnARange = SpreadsheetApp.getActiveSheet().getRange(eventRange.getRow(), 1, eventRange.getNumRows(), 1);
    var values = columnARange.getValues();
    for (var i = 0; i < values.length; i++) {
       values[i][0] = new Date();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.