Skip to content

Instantly share code, notes, and snippets.

@olostan
Created September 28, 2015 16:11
Show Gist options
  • Save olostan/83fa808e7885f929230a to your computer and use it in GitHub Desktop.
Save olostan/83fa808e7885f929230a to your computer and use it in GitHub Desktop.
/**
* Adds a custom menu with items to show the sidebar and dialog.
*
* @param {Object} e The event parameter for a simple onOpen trigger.
*/
function onOpen(e) {
SpreadsheetApp.getUi()
.createAddonMenu()
.addItem('Add Quotes', 'addQuotes')
.addToUi();
}
/**
* Runs when the add-on is installed; calls onOpen() to ensure menu creation and
* any other initializion work is done immediately.
*
* @param {Object} e The event parameter for a simple onInstall trigger.
*/
function onInstall(e) {
onOpen(e);
}
function addQuotes() {
var range = SpreadsheetApp.getActiveSheet().getActiveRange();
var values = range.getValues();
for (var i = 0;i<values.length;i++) {
values[i][0] = "'"+values[i][0];
}
range.setValues(values);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment