V
viveksingh
hi,
I have write a function to track when spreadsheet cell have edited. To achieve this I written below script and it's working fine.
But when I/Team copy paste multiple value then it is not working for all cell only current selected cell reference value(timestamp) updating.
Can you help me what things need to be change to execute function on for more that one selected cells copy/paste value.
Current running code for first scenario is :
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "TrackTimeStamp" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 2 ) { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() === '' ) //is empty?
var time = new Date();
time = Utilities.formatDate(time, "IST", "HH:mm:ss");
nextCell.setValue(time);
};
};
}
I have write a function to track when spreadsheet cell have edited. To achieve this I written below script and it's working fine.
But when I/Team copy paste multiple value then it is not working for all cell only current selected cell reference value(timestamp) updating.
Can you help me what things need to be change to execute function on for more that one selected cells copy/paste value.
Current running code for first scenario is :
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "TrackTimeStamp" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 2 ) { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() === '' ) //is empty?
var time = new Date();
time = Utilities.formatDate(time, "IST", "HH:mm:ss");
nextCell.setValue(time);
};
};
}