Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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

marked as duplicate by Rubén, serenesat, ᴡᴏʀᴅs, jonsca Mar 22 at 22:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 4 down vote accepted

Try this answer from SO:


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");
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

protected by Community Nov 15 '13 at 22:10

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

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.