-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPage.html
281 lines (248 loc) · 8.65 KB
/
Page.html
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
<style>
.bodyContent {
padding: 10px;
}
.section + .section {
margin-top: 35px;
}
.header {
font-weight: bold;
font-size: 18px;
color: #dd4b39;
margin-top: 6px;
margin-bottom: 6px;
}
.description {
font-size: 14px;
}
.label {
font-weight: bold;
font-size: 14px;
margin-bottom: 6px;
}
.textInput {
width: 110px;
height: 28px;
}
.wideTextInput {
width: 100%;
}
.button {
padding-left: 8px;
padding-right: 8px;
}
</style>
<script>
google.script.run
.withSuccessHandler(setValueOnInput)
.withUserObject('refresh_range')
.onGetRefreshRangeButtonClick();
function onSelectSheetButtonClick(updateId) {
google.script.run
.withSuccessHandler(setValueOnInput)
.withUserObject(updateId)
.getActiveSheetName();
}
function onSelectCellButtonClick(updateId) {
google.script.run
.withSuccessHandler(setValueOnInput)
.withUserObject(updateId)
.getActiveCell();
}
function onSelectRangeButtonClick(updateId) {
google.script.run
.withSuccessHandler(setValueOnInput)
.withUserObject(updateId)
.getActiveRange();
}
function setValueOnInput(value, updateId) {
document.getElementById(updateId).value = value || '';
}
function onSetRefreshRangeButtonClick() {
google.script.run
.onSetRefreshRangeButtonClick(
getInputValue('refresh_range'));
}
function onGetRefreshRangeButtonClick() {
google.script.run
.withSuccessHandler(setValueOnInput)
.withUserObject('refresh_range')
.onGetRefreshRangeButtonClick();
}
function onClearRefreshRangeButtonClick() {
google.script.run
.onClearRefreshRangeButtonClick();
clearInput('refresh_range');
}
function onGenerateFormulasButtonClick() {
google.script.run
.onGenerateFormulasButtonClick(
getInputValue('data_sheet_name'),
getInputValue('data_key_range'),
getInputValue('data_value_range'),
getInputValue('target_sheet_name'),
getInputValue('target_key_range'),
getInputValue('target_value_range'),
getInputValue('target_output_range'),
getInputValue('formula_template'));
}
function getInputValue(id) {
return getElement(id).value;
}
function clearInput(id) {
return getElement(id).value = '';
}
function getElement(id) {
return document.getElementById(id);
}
</script>
</head>
<body>
<div class="bodyContent" class="sidebar branding-below">
<div class="section">
<p class="header">Formula Refresher</p>
<p class="description">
Select a range of cells to occasionally refresh in order to
force formulas to recalculate even when there are no changes.
</p>
<p class="description">
Refreshes are necessary for custom third-party formulas that return
live data from the internet. The formulas would otherwise only be
recalculated when the inputs change, which may never be the case.
</p>
<p class="description">
The active sheet can be refreshed by clicking the Set Range button.
All sheets, active and inactive, are refreshed automatically on a 15 minute interval.
</p>
<div class="block">
<p class="label">Range to Refresh:</p>
<div>
<div class="inline form-group">
<input id="refresh_range" type="text" class="textInput" placeholder="A1:A5" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectRangeButtonClick('refresh_range')">Select Range</button>
</div>
</div>
</div>
<div class="block">
<div>
<div class="inline form-group">
<button class="action button submit" onclick="onSetRefreshRangeButtonClick()">Set Range</button>
</div>
<div class="inline form-group">
<button class="button" onclick="onGetRefreshRangeButtonClick()">Get Range</button>
</div>
<div class="inline form-group">
<button class="button" onclick="onClearRefreshRangeButtonClick()">Clear Range</button>
</div>
</div>
</div>
</div>
<div class="section">
<p class="header">Formula Generator</p>
<p class="description">
Relate cells and generate formulas in different areas of the spreadsheet by using linking information such as ids and dates.
</p>
<p class="description">
This add-on was designed with currency exchange rate calculations in mind and works well even when
currency exchange dates, i.e. keys, are defined out-of-order and in different tables or sheets.
</p>
<div class="block">
<p class="label">Data Sheet:</p>
<div>
<div class="inline form-group">
<input id="data_sheet_name" type="text" class="textInput" placeholder="Sheet Name" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectSheetButtonClick('data_sheet_name')">Select Sheet</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Data Key Range:</p>
<div>
<div class="inline form-group">
<input id="data_key_range" type="text" class="textInput" placeholder="A1:A5" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectRangeButtonClick('data_key_range')">Select Range</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Data Value Range:</p>
<div>
<div class="inline form-group">
<input id="data_value_range" type="text" class="textInput" placeholder="B1:B5" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectRangeButtonClick('data_value_range')">Select Range</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Target Sheet:</p>
<div>
<div class="inline form-group">
<input id="target_sheet_name" type="text" class="textInput" placeholder="Sheet Name" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectSheetButtonClick('target_sheet_name')">Select Sheet</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Target Key Range:</p>
<div>
<div class="inline form-group">
<input id="target_key_range" type="text" class="textInput" placeholder="A1:A5" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectRangeButtonClick('target_key_range')">Select Range</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Target Value Range:</p>
<div>
<div class="inline form-group">
<input id="target_value_range" type="text" class="textInput" placeholder="B1:B5" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectRangeButtonClick('target_value_range')">Select range</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Target Output Range:</p>
<div>
<div class="inline form-group">
<input id="target_output_range" type="text" class="textInput" placeholder="C1:C5" />
</div>
<div class="inline form-group">
<button class="button" onclick="onSelectRangeButtonClick('target_output_range')">Select range</button>
</div>
</div>
</div>
<div class="block">
<p class="label">Formula Template:</p>
<div>
<div class="inline form-group">
<input id="formula_template" type="text" class="textInput, wideTextInput" placeholder="=@target*@data" value="=@target*@data"/>
</div>
</div>
<p class="description">Note that @target and @data will be replaced with the mapped values.</p>
</div>
<div class="block">
<button class="action button submit" onclick="onGenerateFormulasButtonClick()">Map & Generate</button>
</div>
</div>
</div>
</body>
</html>