Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Try this answer from SO:

http://stackoverflow.com/questions/11458470/automatic-timestamp-when-a-cell-is-filled-out

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);
   };
 };
}
share|improve this answer
    
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. –  OnenOnlyWalter 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? –  William Jackson Oct 9 '12 at 1:18
    
I just thought of that, just changed the name and tried it. Still doesn't work. Its closing time at the work here. I'll be home shortly to work on it more. –  myanda Oct 9 '12 at 1:22
show 10 more comments

protected by Community Nov 15 '13 at 22:10

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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