-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsvUpload.html
49 lines (41 loc) · 1.18 KB
/
csvUpload.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
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<form>
<input type="file" multiple="false" accept=".csv" onchange="handleFileChange()">
</form>
<script>
const inputEl = document.querySelector('input');
async function handleFileChange() {
const file = inputEl.files[0];
if (file) {
inputEl.disabled = true;
google.script.run
.withSuccessHandler(() => google.script.host.close())
.withFailureHandler((err) => {
inputEl.disabled = false;
console.error(err);
alert("failed to import csv file!");
})
.handleCSVSubmit(await file.text());
}
}
</script>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
form {
background-color: #d6e5ff;
padding: 10px;
border-style: solid;
border-color: slategrey;
border-width: 2px;
border-radius: 5px;
}
</style>
</body>
</html>