I was working with @W0lf here but I am unable to comment/continue the conversation anymore.
I am trying to use autosort function onOpen but is not working:
function onOpen(event) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var columnToSortBy = 4;
var tableRange = "A2:F99";
var range = sheet.getRange(tableRange);
range.sort( { column : columnToSortBy, ascending: false } );
}
@w0lf's code for onEdit is working:
function onEdit(event){
var sheet = event.source.getActiveSheet();
var editedCell = sheet.getActiveCell();
var columnToSortBy = 4;
var tableRange = "A2:F99";
if(editedCell.getColumn() == columnToSortBy){
var range = sheet.getRange(tableRange);
range.sort( { column : columnToSortBy, ascending: false } );
}
}