I would like to be able to limit the range of cells being assessed by this script to the first column. Apply the timestamp to the last column and only have the script run on a specific sheet "Short Sale/REO Pricing".

function onEdit() {
  var s = SpreadsheetApp.getActiveSheet();
  var r = s.getActiveCell();

  // check the column
  if( r.getColumn() != 2 ) { 
    var row = r.getRow();
    var time = new Date();
    time = Utilities.formatDate(time, "GMT-08:00", "MM/DD/yy, hh:mm:ss");
    SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);

Any ideas?


This needs testing but something like this:


  if( r.getColumn() != 2 ) { 


  if( r.getColumn() == 2 && s.getName() == "Short Sale/REO Pricing" ) { 

test the above, then change:

    SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);


  SpreadsheetApp.getActiveSheet().getRange(row, s.getLastColumn()).setValue(time);

The google-apps-script is "javascript".

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.