if(Input::hasFile('excel_file')){
$path = Input::file('excel_file')->getRealPath();
$data = Excel::load($path, function($reader) {
$reader->setDateFormat('Y-m-d');
})->get();
$objPHPExcel = new PHPExcel();
$highestColumn = $objPHPExcel->setActiveSheetIndex(0)->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
echo $highestColumnIndex;
exit();
}
我可以使用 $data->count() 导入 excel 文件并计算行数。但我无法弄清楚列号。我怎样才能得到行中有多少列?我也尝试过使用 phpexcel,但失败了。非常需要解决方案。