.sort() won't work on a sheet object. You need to get the data from the sheet first.
To get the data, you need to define the range and then get the values from the range. Like this:
/** @OnlyCurrentDoc */
function sortResponses() {
const sheet = SpreadsheetApp.getActive().getSheetByName("Form Responses 1");
let data = sheet.getDataRange().getValues();
data.sort(1, false);
}
On Wednesday, September 6, 2023 at 11:32:41 PM UTC-4 Pedri Haryadi wrote:
Maybe you can try:var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Form Responses 1");