<?php
include_once 'E:\project\fapiao\server\php\vendor\phpoffice\phpexcel\Classes\PHPExcel\IOFactory.php';
include_once 'E:\project\fapiao\server\php\vendor\phpoffice\phpexcel\Classes\PHPExcel\Cell.php';
$a = PHPExcel_IOFactory::load('C:\Users\Administrator\Desktop\Gardenia_07051602.xlsx');
$objWorksheet = $a->getSheet(0);
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString ( $highestColumn );
$excelData = [];
for($row = 1; $row <= $highestRow; $row++) {
for($col = 0; $col < $highestColumnIndex; $col++) {
echo $objWorksheet->getCellByColumnAndRow( $col, $row )->getValue() . '--';
}
echo "<br>";
}
print_r($excelData);
参考: