I want to move a sheet within the spreadsheeet using apps script. How to do it?
Best live!
To duplicate a sheet:Click the tab of the sheet you want to duplicate, then select Duplicate from the menu that appears. A duplicate of the sheet will appear in the sheets toolbar. It will be named as a copy of the original sheet, such as Copy of May. If you want, you can rename the sheet.
Sort an entire sheet On your computer, open a spreadsheet in Google Sheets. At the top, right-click the letter of the column you want to sort by. Click Sort sheet A to Z or Sort sheet Z to A.
Have you looked at the documentation ?
It does show an example as well :
// This example assumes there are two sheets in the current
// active spreadsheet: one named "first", and another named "second",
// and that the current active sheet (first) is in position 1
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName("first");
// This should output 'Current index of sheet: 1'
Logger.log("Current index of sheet: %s", sheet.getIndex());
spreadsheet.moveActiveSheet(2);
// This should output 'New index of sheet: 2'
Logger.log("New index of sheet: %s", sheet.getIndex());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With