How to find out how many rows and columns to read from an Excel file with PHPExcel?

前端 未结 6 568
眼角桃花
眼角桃花 2020-12-12 23:51

With the following code, I am able to read the cells out of an Excel file with PHPExcel.

I currently manually define how many rows and columns to re

6条回答
  •  自闭症患者
    2020-12-13 00:43

    From the 1.7.6 and below PHPExcel versions it is possible to get worksheet information without reading whole file:

    $objReader     = PHPExcel_IOFactory::createReader("Excel2007"); 
    $worksheetData = $objReader->listWorksheetInfo($uploadedfile);
    $totalRows     = $worksheetData[0]['totalRows'];
    $totalColumns  = $worksheetData[0]['totalColumns'];
    

提交回复
热议问题