How to move sheet within Google Spreadsheeet using

2019-04-28 20:46发布

This question already has an answer here:

I want to move a sheet within the spreadsheeet using apps script. How to do it?

Best live!

1条回答
再贱就再见
2楼-- · 2019-04-28 21:38

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());
查看更多
登录 后发表回答