-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.html
52 lines (52 loc) · 1.51 KB
/
sidebar.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
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
<script>
function saveAndClose(){
var source = document.getElementById("source");
var sourceSheet = source.options[source.selectedIndex].value;
var target = document.getElementById("target");
var targetSheet = target.options[target.selectedIndex].value;
var rowToCopy = document.getElementById("row").value;
google.script.run.setPreferences(sourceSheet, targetSheet, rowToCopy);
google.script.host.close();
}
</script>
</head>
<body>
<div>Source Sheet:
<select id="source">
<?
var data = getSheetNames();
var prefs = getPreferences();
for (var i = 0; i < data.length; i++) { ?>
<option
<? if (prefs['sourceSheet'] == data[i]) { ?> selected<? } ?> > <?= data[i] ?>
</option>
<? } ?>
</select>
</div>
<br />
<br />
<div>Target Sheet:
<select id="target">
<?
for (var i = 0; i < data.length; i++) { ?>
<option
<? if (prefs['targetSheet'] == data[i]) { ?> selected<? } ?> > <?= data[i] ?>
</option>
<? } ?>
</select>
</div>
<br />
<br />
<div>Row to copy:
<input id="row" type="number" min="1" style="width:72px" value="<?= prefs['rowToCopy'] ?>" />
</div>
<br />
<br />
<input type="button" value="Save and Close" onclick="saveAndClose()" />
</body>
</html>