I have a Macro that is activated by a button in my Sheets. It does exactly what I want it to do separated, but when I tried to combine both functions (Autofill & Sort), it doesn't finish the sort. My guess is that it is doing it all simultaneously so it's sorting before the autofill calculation is actually completed/displayed. Any way to adjust this macro so it does the Autofill and then the Sort?
Code:
function Sorting() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('N3:Q3').activate();
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('N3:Q'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
spreadsheet.getRange('A3:Q').activate()
.sort({column: 17, ascending: false});
};