Zobrazení CSV v HTML tabulce místo stahování
This commit is contained in:
parent
5a8cb74575
commit
634b3ada56
46
2024.html
Normal file
46
2024.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="cs">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Přehled Financí 2024</title>
|
||||||
|
<link rel="stylesheet" href="styly.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Přehled Financí za rok 2024</h1>
|
||||||
|
<table id="finance-table" border="1">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Datum</th>
|
||||||
|
<th>Popis</th>
|
||||||
|
<th>Částka</th>
|
||||||
|
<th>Měna</th>
|
||||||
|
<th>Typ</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
fetch('finance_2024.csv')
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
let rows = data.split("\n").slice(1);
|
||||||
|
let tableBody = document.querySelector("#finance-table tbody");
|
||||||
|
rows.forEach(row => {
|
||||||
|
let columns = row.split(",");
|
||||||
|
if (columns.length >= 5) {
|
||||||
|
let tr = document.createElement("tr");
|
||||||
|
columns.forEach(column => {
|
||||||
|
let td = document.createElement("td");
|
||||||
|
td.textContent = column.trim();
|
||||||
|
tr.appendChild(td);
|
||||||
|
});
|
||||||
|
tableBody.appendChild(tr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => console.error("Chyba při načítání CSV:", error));
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -22,7 +22,7 @@
|
|||||||
Archiv
|
Archiv
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="finance_2024.csv" target="_blank">2024</a>
|
<a class="dropdown-item" href="2024.html" target="_blank">2024</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="account-balance text-center mb-3">
|
<div class="account-balance text-center mb-3">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user