Forked from theredstapler/PHPExcel Tutorial - Read an Excel File.php
Created
December 12, 2016 23:42
-
-
Save kaanuki/6b6f35ed3d8030a1d3c6817a5d38afa7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype> | |
<html> | |
<head> | |
</head> | |
<body> | |
<?php | |
require_once "Classes/PHPExcel.php"; | |
$tmpfname = "test.xlsx"; | |
$excelReader = PHPExcel_IOFactory::createReaderForFile($tmpfname); | |
$excelObj = $excelReader->load($tmpfname); | |
$worksheet = $excelObj->getSheet(0); | |
$lastRow = $worksheet->getHighestRow(); | |
echo "<table>"; | |
for ($row = 1; $row <= $lastRow; $row++) { | |
echo "<tr><td>"; | |
echo $worksheet->getCell('A'.$row)->getValue(); | |
echo "</td><td>"; | |
echo $worksheet->getCell('B'.$row)->getValue(); | |
echo "</td><tr>"; | |
} | |
echo "</table>"; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment