Created
December 10, 2018 17:33
-
-
Save ndthanh/af06e4256859da8d66312905340f9d11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//3. sort sheets alphabetically | |
function sortSheets() { | |
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheets = spreadsheet.getSheets(); | |
var sheetNames = []; | |
sheets.forEach(function(sheet,i) { | |
sheetNames.push(sheet.getName()); | |
}); | |
sheetNames.sort().forEach(function(sheet,i) { | |
spreadsheet.getSheetByName(sheet).activate(); | |
spreadsheet.moveActiveSheet(i + 1); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment