Can anyone help me please, it's regarding auto sort script for google sheets? I'm not familiar with script actually, but what I'm trying to do is to auto sort the dates entered on column A on my table range. I found a generic script below which I tried on my google sheets and it actually works on manual edit on the same sheet. However, the values on my table range are results of my (Index,Match) formula from another sheet so whenever a new value is entered from another sheet it will not automatically get sorted.
Here's the sample script which I tried on my google sheets:
function onEdit(event){
var sheet = event.source.getActiveSheet();
var editedCell = sheet.getActiveCell();
var columnToSortBy = 1;
var tableRange = "A2:J61"; // What to sort.
if(editedCell.getColumn() == columnToSortBy){
var range = sheet.getRange(tableRange);
range.sort( { column : columnToSortBy, ascending: true});
}
}
Can anyone guide me to modify this script, please...
Here's the link to sample google sheet which I'm trying to work on: