-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinterface.js
45 lines (31 loc) · 984 Bytes
/
interface.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('SPAG Builder')
.addItem('Create Product ID Sheet', 'idSheet')
.addItem('Settings', 'showSidebar')
.addSeparator()
.addItem('Run', 'spagBuilder')
.addSeparator()
.addItem('Email CSV', 'sendCsv')
.addToUi();
}
function showSidebar() {
var html = HtmlService.createHtmlOutputFromFile('Sidebar')
.setTitle('SPAG Builder')
.setWidth(300);
SpreadsheetApp.getUi()
.showSidebar(html);
}
function processForm(formObject) {
var ui = SpreadsheetApp.getUi();
var userProperties = PropertiesService.getUserProperties();
var settings = JSON.stringify(formObject)
userProperties.setProperties(formObject);
ui.alert("Saved the following settings: " + settings)
}
function idSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.insertSheet('IDs');
var ids = ss.getSheetByName("IDs");
ids.appendRow(["Product Name", "Product ID"])
}