Writing a script to sort a sheet by a range , A4 to the bottom right cell (because rows and/or columns may be added). The script finds the cell of the last column/last row and then uses that in the range var. Problem is when I try to run this script it gives me "Missing ) after argument list. (line 8, file "Sort By Gamer Tag")". But I've closed all the "(".
Any advice?
Thanks
function sortByGamerTag() {
var ss=SpreadsheetApp.getActiveSpreadsheet();
var sht=ss.getSheetByName('Master Summary 2');
var lastRow=sht.getLastRow();
var lastCol=sht.getLastColumn();
var lastCell=sht.getCell(lastCol,lastRow);
var range = sht.getRange("A4":lastCell);
range.sort(2);
}