Google Spreadsheet Timestamp for columns B & D?
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);
};
};
}
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);
};
};
}
No comments:
Post a Comment