I use a Google Form for people to request days off. An add-on called Form Approvals is used to send emails to certain people who can approve or deny the request. In the Google Sheet listing the responses, new entries keep going to the bottom.
Is there a way to make new entries from the Google Form to be sorted automatically by the date of the day off in the Google Sheet?
I found this script, but it doesn't work:
function onEdit(event){
var sheet = event.source.getActiveSheet();
var editedCell = sheet.getActiveCell();
var columnToSortBy = 2;
var tableRange = sheet.getDataRange();
if(editedCell.getColumn() == columnToSortBy){
var range = sheet.getRange(tableRange);
range.sort( { column : columnToSortBy } );
}
}
Also, is there a way to specify which sheet tab for the script to run on?