I have this function which auto puts in the date in the second colum, but i need it to work on a second sheet. It now doesnt work.. How do i join them on the one function to work
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Contracts Log" ) { //checks that we're on Sheet1 or not
var r = s.getActiveCell();
if( r.getColumn() == 1 ) { //checks that the cell being edited is in column A
var nextCell = r.offset(0, 1);
if( nextCell.getValue() === '' ) //checks if the adjacent cell is empty or not?
nextCell.setValue(new Date());
}
}
}
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Contracts Log" ) { //checks that we're on Sheet1 or not
var r = s.getActiveCell();
if( r.getColumn() == 1 ) { //checks that the cell being edited is in column A
var nextCell = r.offset(0, 1);
if( nextCell.getValue() === '' ) //checks if the adjacent cell is empty or not?
nextCell.setValue(new Date());
}
}
}