废话不说:
load($fname)->getSheet(0);
$rows = $sheet->getHighestRow(); // 取得总行数
$columns = $sheet->getHighestColumn(); // 取得总列数
//$columns = ord($columns) - ord('A') + 1;
for($i = 1; $i <= $rows; $i++) {
for ($j=1; $j <= $columns; $j++) {
$val = $sheet->getCellByColumnAndRow($j, $i)->getValue();
echo "row: $i" . ", col:$j" . ", val:$val" . "\n";
}
}
}
if ($argc != 2) {
echo "usage $argv[0] " . " [excel]" . "\n";
return -1;
}
parse($argv[1]);
PHPExcel下载地址:
查看原文:http://chimmu.dynu.net/2017/01/13/%e7%94%a8phpexcel%e8%af%bb%e5%8f%96excel/