forked from odbol/column-copier-google-sheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (63 loc) · 1.72 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style type="text/css">
body {
font-family: Arial, sans-serif;
}
label, select {
display: block;
margin: 10px;
}
.hidden {
display: none;
}
.shown {
display: block;
}
</style>
</head>
<body>
<div id="step1">
<p>Choose which sheets to sync column names and rows.</p>
<p>This script will take each column in the "From" sheet, and copy the data from each row over
to matching columns in the "To" sheet. If there is no matching column in the "To" sheet, it will
add it to the end.
</p>
<? var data = getAvailableSheets() ?>
<label>Copy columns and data <strong>from</strong>:
<select name="fromSheet" id="fromSheet">
<? for (var i = 0; i < data.length; i++) { ?>
<option><?= data[i] ?></option>
<? } ?>
</select>
</label>
<label><strong>To:</strong>
<select name="toSheet" id="toSheet">
<? for (var i = 0; i < data.length; i++) { ?>
<option><?= data[i] ?></option>
<? } ?>
</select>
</label>
<script>
function save() {
var fromSheet = document.getElementById('fromSheet').value;
var toSheet = document.getElementById('toSheet').value;
google.script.run.saveSheets(fromSheet, toSheet);
document.getElementById('step1').className = 'hidden';
document.getElementById('step2').className = 'shown';
}
function done() {
google.script.host.close();
}
</script>
<p></p>
<button onclick="save()">Save and prepare columns</button>
</div>
<div id="step2" class="hidden">
<p>Now close this window and click <code>Column Sync->Admin->Set up columns</code>.</p>
<button onclick="done()">Close</button>
</div>
</body>
</html>