I am working on a Google Apps Script spreadsheet application, and one of the abilities I would like the program to have is to automatically sort a series of form responses based on data from 2 different columns. So I would want to sort it by the data in column 16 and then sort by column 1. I can achieve this functionality manually using the method at: https://drive.googleblog.com/2010/06/tips-tricks-advanced-sorting-rules-in.html
Currently I am running the Spreadsheet.sort(column, ascending)
function with the first column, but I cannot make it sort so that it will accept the second column as an additional sorting rule. Is there a method in Google Apps Script that I could use to emulate this functionality?
See doc: https://developers.google.com/apps-script/reference/spreadsheet/range#sort(Object)
You can do the sorting at array level, just get data from the sheet to a matrix and sort the matrix in multiple passes choosing the column you want to sort on.
something like this :
or better, following Adam's comment :
but Michael's answer if more clever using build in Range.sort method that I was not aware of (at least of its extended possibilities).