SankeySheets/scripts/Addon.js
2016-05-24 15:08:12 +01:00

39 lines
838 B
JavaScript

'use strict';
/**
* 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('Create Sankey Chart', 'showSankeySnip')
.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);
}
/**
* Opens a sidebar.
*/
function showSankeySnip() {
var ui = HtmlService.createTemplateFromFile('index.html')
.evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setTitle('Sankey Snip');
SpreadsheetApp.getUi().showSidebar(ui);
}