6

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?

Rubén - Volunteer Moderator -
  • 46,305
  • 18
  • 101
  • 297
myanda
  • 81
  • 1
  • 1
  • 5

1 Answers1

8

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");
       nextCell.setValue(time);
   };
 };
}
galoget
  • 109
  • 5
OnenOnlyWalter
  • 7,424
  • 1
  • 35
  • 48