I got the below code from google for retrieving last 10 records- I am trying to sort the resulting range alone which will be displayed in html form. Problem is the below sorting order sorts on my 4th column, but I also want to sort next by 2nd column. - How to achieve that?
const SPREADSHEETID = "<<sheetid>>";const DATARANGE = "Data!A2:F";const DATASHEET = "Data";function readRecord(range) { try { let result = Sheets.Spreadsheets.Values.get(SPREADSHEETID, range); return result.values; } catch (err) { console.log('Failed with error %s', err.message); }}function getLastTenRecords() { let lastRow = readRecord(DATARANGE).length + 1; let startRow = lastRow - 20; if (startRow < 2) { startRow = 2; } let range = DATASHEET +"!A" + startRow +":" + LASTCOL + lastRow; let lastTenRecords = readRecord(range); Logger.log(lastTenRecords); return lastTenRecords.sort((a, b) => a[4] > b[4] ? 4 : -4);}