I have a very long script and have summarized the commands that I use numerous times in the script, which are of these types:
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('Page 1!A1').activate();
spreadsheet.getCurrentCell().setFormula('=UNIQUE(H2:H)');
spreadsheet.getRange('Page 2!P1:P').activate();
spreadsheet.getRange('Page 3!A1:A').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
spreadsheet.getRange('Page 3!A1').activate();
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
//----------------------------------------------
var ss = SpreadsheetApp.getActiveSpreadsheet();
var page = ss.getSheets()[0];
var range = page.getRange('Page 4!A2:R51');
range.sort({column:8, ascending:false});
And I would like to know how I could speed up these procedures, as I learned to create most things by Macro, I end up also playing for scripts and I know there is no need to use them, but I have a little difficulty adjusting and removing Things that are unnecessary.