-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
72 lines (60 loc) · 1.73 KB
/
index.html
File metadata and controls
72 lines (60 loc) · 1.73 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Google Sheet Table</title>
<!-- DataTables CSS -->
<link
rel="stylesheet"
href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css"
>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
}
</style>
</head>
<body>
<h2>Google Sheet Viewer</h2>
<table id="sheetTable" class="display" style="width:100%">
<thead></thead>
<tbody></tbody>
</table>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- DataTables -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<!-- PapaParse (CSV parser) -->
<script src="https://cdn.jsdelivr.net/npm/papaparse@5.4.1/papaparse.min.js"></script>
<script>
const sheetUrl =
"https://docs.google.com/spreadsheets/d/e/2PACX-1vSPWGXhcSh2L4pfXzXa7hioqhT9ylN0RHZLgPuSrLQZuc26trhlvwa0l2q3p5IkRRGhAFHpJRp21Vas/pub?gid=0&single=true&output=csv";
Papa.parse(sheetUrl, {
download: true,
header: true,
complete: function(results) {
const data = results.data;
const columns = Object.keys(data[0]).map(col => ({
title: col,
data: col,
render: function(value) {
if (col.toLowerCase() === "link" && value) {
return `<a href="${value}" target="_blank" rel="noopener noreferrer">
link to file
</a>`;
}
return value;
}
}));
$('#sheetTable').DataTable({
data: data,
columns: columns,
pageLength: 10
});
}
});
</script>
<h2><a href = "https://scientificslidelibrary.streamlit.app/">Submit a new file</a></h2>
</body>
</html>