Hot answers tagged

2

Try this instead. Code function onOpen() { var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets(); for(var i = 0, iLen = sheets.length; i < iLen; i++) { var sheet = sheets[i], range = sheet.getDataRange(); range.sort({column: 1, ascending: true}); } } If you want to sort from a certain row or column, then use this code ...


1

This duplicates data (or since the source for the query is itself imported, even triplicates) but does seem to provide automatic resorting as data input changes: =query(A1:B5,"Select * order by B desc")


1

The following script sorts parts of the active sheet by the first column. The parts are separated by blank entries in the first column. So, for example +-------+ | Title | +-------+ | sss | | bbb | | | | eee | | wwww | | ccc | +-------+ becomes +-------+ | Title | +-------+ | bbb | | sss | | | | ccc | | eee | | wwww | ...



Only top voted, non community-wiki answers of a minimum length are eligible