Skip to content

Instantly share code, notes, and snippets.

@evilnapsis
Created March 27, 2017 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilnapsis/4cbc5be14ba6f52799d6386ee82bc149 to your computer and use it in GitHub Desktop.
Save evilnapsis/4cbc5be14ba6f52799d6386ee82bc149 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Leer Archivo Excel</title>
</head>
<body>
<h1>Leer Archivo Excel</h1>
<?php
require_once 'PHPExcel/Classes/PHPExcel.php';
$archivo = "libro1.xlsx";
$inputFileType = PHPExcel_IOFactory::identify($archivo);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($archivo);
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
for ($row = 2; $row <= $highestRow; $row++){
echo $sheet->getCell("A".$row)->getValue()." - ";
echo $sheet->getCell("B".$row)->getValue()." - ";
echo $sheet->getCell("C".$row)->getValue();
echo "<br>";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment