Skip to content

Instantly share code, notes, and snippets.

@minhhahl
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save minhhahl/2b5f58fe96bc26011bab to your computer and use it in GitHub Desktop.

Select an option

Save minhhahl/2b5f58fe96bc26011bab to your computer and use it in GitHub Desktop.
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Custom Menu')
.addItem('Update Sheet Name', 'menuUpdateSheetName')
.addToUi();
}
function menuUpdateSheetName() {
var sheets = SpreadsheetApp.getActive().getSheets();
for (var i = 0; i < sheets.length; i++) {
var sheet = sheets[i];
var sheetName = sheet.getName();
var cell = sheet.getRange('a1'); // Place cell range here
cell.setValue(sheetName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment