1
The following code detects whether a change has been made to a cell in column I or J, and records the date and time the change occurred in column M and N.
I want there to be only one record, that is, it does not record in column N, but only in M. But it is not working, it ends up recording a change for each cell in two respective cells, as in the figure.
How to change this?
function onEdit(event) {
var ActiveSheet= SpreadsheetApp.getActiveSheet();
var capture = ActiveSheet.getActiveCell();
if(capture.getColumn() == 9 || capture.getColumn() == 10 && ActiveSheet.getName() == "AlertaCompleto" ){
var add = capture.offset(0,4);
var data = new Date();
data = Utilities.formatDate(data, "GMT-03:00","dd-MM-yyyy' 'HH:mm:ss' '");
add.setValue(data);
}
}