I can’t seem to get the syntax correct…
I’m trying to get the total number of sheets in a spreadsheet and set the last one to the active sheet. I then want to duplicate the sheet, rename and delete rows 3 to the last row.
This is some of the code I’ve been playing with:
var logbook = SpreadsheetApp.openById("keycode here");
var logbookSheets = logbook.getSheets();
var numSheets = logbook.getNumSheets();
logbook.setActiveSheet(logbookSheets[numSheets]).duplicateActiveSheet();
I have never used
duplicateActiveSheetand since the code editor does not complete for it (at least not yet), I’d not use it.Here’s is how I’d do it: