-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexcel_reader.php
More file actions
57 lines (45 loc) · 1.13 KB
/
excel_reader.php
File metadata and controls
57 lines (45 loc) · 1.13 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
<html>
<head>
<style type="text/css">
td,th {
border: 1px solid rgb(190, 190, 190);
padding: 10px;
}
td {
text-align: center;
}
tr:nth-child(even) {
background-color: #eee;
}
table {
border-collapse: collapse;
border: 2px solid rgb(200, 200, 200);
letter-spacing: 1px;
font-family: sans-serif;
font-size: .8rem;
}
</style>
</head>
<body>
<?php
include "SimpleXLSX.php";
echo '<h1>Data Shipping Table 2020</h1><pre>';
if ($xlsx = SimpleXLSX::parse('data_shipping.xlsx') ) {
//print_r($xlsx->rows());
echo '<table><tbody>';
$i = 0;
foreach ($xlsx->rows() as $elt) {
if ($i == 0) {
echo "<tr><th>" . $elt[0] . "</th><th>" . $elt[1] . "</th><th>" . $elt[2] . "</th><th>" . $elt[3] . "</th><th>" . $elt[4] . "</th></tr>";
} else {
echo "<tr><td>" . $elt[0] . "</td><td>" . $elt[1] . "</td><td>" . $elt[2] . "</td><td>" . $elt[3] . "</td><td>" . $elt[4] . "</td></tr>";
}
$i++;
}
echo "</tbody></table>";
} else {
echo SimpleXLSX::parseError();
}
?>
</body>
</html>