Skip to content

Commit d7f5b97

Browse files
authored
Add files via upload
1 parent 195b015 commit d7f5b97

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

index.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Google Sheet Table</title>
6+
7+
<!-- DataTables CSS -->
8+
<link
9+
rel="stylesheet"
10+
href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css"
11+
>
12+
13+
<style>
14+
body {
15+
font-family: Arial, sans-serif;
16+
margin: 40px;
17+
}
18+
</style>
19+
</head>
20+
<body>
21+
22+
<h2>Google Sheet Viewer</h2>
23+
24+
<table id="sheetTable" class="display" style="width:100%">
25+
<thead></thead>
26+
<tbody></tbody>
27+
</table>
28+
29+
<!-- jQuery -->
30+
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
31+
32+
<!-- DataTables -->
33+
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
34+
35+
<!-- PapaParse (CSV parser) -->
36+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/papaparse.min.js"></script>
37+
38+
<script>
39+
const sheetUrl =
40+
"https://docs.google.com/spreadsheets/d/1BqFpAy8BcnHrVwEZgJSaRt3LpOVFBfk04PXRdKjNrJg/gviz/tq?tqx=out:csv";
41+
42+
Papa.parse(sheetUrl, {
43+
download: true,
44+
header: true,
45+
complete: function(results) {
46+
const data = results.data;
47+
const columns = Object.keys(data[0]).map(col => ({
48+
title: col,
49+
data: col,
50+
render: function(value) {
51+
if (col.toLowerCase() === "link" && value) {
52+
return `<a href="${value}" target="_blank" rel="noopener noreferrer">
53+
link to file
54+
</a>`;
55+
}
56+
return value;
57+
}
58+
}));
59+
60+
$('#sheetTable').DataTable({
61+
data: data,
62+
columns: columns,
63+
pageLength: 10
64+
});
65+
}
66+
});
67+
</script>
68+
69+
</body>
70+
</html>

0 commit comments

Comments
 (0)