I have a function OnEdit Script running that used to auto sort on edit column 3 that is no longer working when edited; I have to go in and run it manually to get it to sort. It works in another google sheets file I have. Can someone please help?
My script and file links are below:
https://docs.google.com/spreadsheets/d/1DcLsFpVn90hCg0biVa_zyjKz2GdEmlqui0a3oF0ZQW8/edit?usp=sharing
function OnEdit() {
var sheetNames = ["ALPHA"];
var ss = SpreadsheetApp.getActiveSpreadsheet();
sheetNames.forEach(function(name) {
var sheet = ss.getSheetByName(name);
var range = sheet.getRange(2, 1, sheet.getLastRow() - 1, sheet.getLastColumn());
range.sort([{column: 3, ascending: true}])
});
}