0

This code by @Ruben prints out the timestamp for the first modification for A1 into B1. How to do the same but for the whole column so A2:A printing results into B2:B?

// Global variables
var origin = 'A1';
var destination = 'B1';

function onEdit(e){

  if(e.range.getA1Notation() == origin && 
     e.range.getSheet().getRange(destination).isBlank()){
    e.range.getSheet().getRange(destination).setValue(new Date());
  }
}

Also trying this:

function onEdit(e) {
  // Your sheet params
  var sheetName = "contactos";
  var dateModifiedColumnIndex = 10;
  var dateModifiedColumnLetter = 'K';

  var range = e.range; // range just edited
  var sheet = range.getSheet();
  if (sheet.getName() !== sheetName) {
    return;
  }

  // If the column isn't our modified date column
  if (range.getColumn() != dateModifiedColumnIndex) { 
    var row = range.getRow();
    var dateModifiedRange = sheet.getRange(dateModifiedColumnLetter + row.toString());   

if (dateModifiedRange.isBlank()) {
    dateModifiedRange.setValue(new Date());
}


};