2

I have a spreadsheet with a formula that works to display the timestamp in the same row, but is there a way to set a column at the same time so I don't have multiple time stamps displaying along that row if I update a different column? I'm not too familiar with code so it may be an easy fix.

    function onEdit() { 
    var s = SpreadsheetApp.getActiveSheet(); // Get spreadsheet name 
    var r = s.getActiveCell(); // store active cell name in current spreadsheet 
  var cell1 = 26 // This is the row I want to put values
  if(r.getRow() != cell1) { // Ignores this row (where I put the dates)
    var column = r.getColumn();  // Get column # from active cell
    var time = new Date(); // Get date and time of last mod
    time = Utilities.formatDate(time, "GMT-5:00", "MM/dd/yy, hh:mm"); // Format date and time
    SpreadsheetApp.getActiveSheet().getRange(cell1,column).setValue(time); // put in time in cell
  };
 };
2

At present you have

var column = r.getColumn();  // Get column # from active cell

which means the timestamp gets entered in the column that you edited. If you want to have a single timestamp instead, put

var column = 1;  // timestamp goes to Column A every time

or some other number instead of 1.

| improve this answer | |
  • Thank you so much! I knew it was something really simple. – user107337 Nov 3 '15 at 19:15

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.