I'm looking for some help with my Daily Work Log spreadsheet. I've search and read many different version of making a "TimeStamp" in Google spreadsheet. And it seems I don't have enough experience for it to work correctly. The time stamp script I am using updates every time my spreadsheet auto saves or something is changed.

Here's what I'm tring to do. I have work force of technicians. Initials are AB, DD, RG, JW, RZ.

I want the spreadsheet to time stamp column N when they enter their initials in column M.

I know you can use the keyboard shortcut Ctrl + Shift + : to time stamp a cell. Is there a script I can use to do that action in column N when initials are entered in column M?


Try this answer from StackOverflow:

Here's the relevant code (edited):

function onEdit() {
 var s = SpreadsheetApp.getActiveSheet();
 if( s.getName() == "Sheet1" ) { //checks that we're on the correct sheet
   var r = s.getActiveCell();
   if( r.getColumn() == 13 ) { //checks the column
     var nextCell = r.offset(0, 1);
     if( nextCell.getValue() === '' ) //is empty?
       var time = new Date();
       time = Utilities.formatDate(time, "GMT", "HH:mm:ss");
  • This is great. So I have created a new script and copy / pasted this code. I have changed ( r.getColumn() == 4) to (r.getColumn() == 13) for when column M is edited column N will be stamped with the date. Tried it out and doesn't work. Also I will have to change nextCell.setValue(new Date()); to Time stamp the Current Time instead of current Date.
    – myanda
    Oct 8 '12 at 20:45
  • @myanda - I updated my code to account for your use case. Try that and see if it works. Oct 8 '12 at 23:25
  • Hmmm, entered this new script in my google spreadsheet. Still not working. Any ideas?
    – myanda
    Oct 9 '12 at 1:10
  • Is your sheet named "Sheet1"? If not, did you change the third line in the code to use your sheet name? Oct 9 '12 at 1:18
  • 1
    If you remove the if statement then the script should work on the 13th column in every sheet, regardless of title. As long as the format in each sheet is the same, the 14th column will always get timestamped when the 13th is edited. Oct 9 '12 at 20:16

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