Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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:

Found this script on one of the questions answered in the forum what I don't know enough to make it work. I would like it to time-stamp date and time in column B when they check in and then a separate script when the clock out to time-stamp date and time in column D. Not sure how to do this google spreadsheet. Here is the script below that I found but it will only time-stamp column N when changes are made in column M. Let me know how to change this.

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 question

marked as duplicate by Al E., jonsca Jan 27 at 0:10

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.

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() == 1 ) { //checks the column(A)
     var nextCell = r.offset(0, 1); //offset to same row, and column B; A+1
     if( nextCell.getValue() === '' ) { //is empty?
       var time = new Date();
       time = Utilities.formatDate(time, "CST", "yyyy-MM-dd' - 'HH:mm:ss");
       nextCell.setValue(time);
     };
   };
   if( r.getColumn() == 3) { //checks the column(C)
     var nextCell = r.offset(0,1); //offset to same row, and column D; C+1
     if( nextCell.getValue() === '' ) { //is empty?
       var time = new Date();
     time = Utilities.formatDate(time, "CST", "yyyy-MM-dd' - 'HH:mm:ss");
     nextCell.setValue(time);
     };
   };
 };
}

Got "Utilities.formatDate" info here

share|improve this answer

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