How can i read Excel worksheet row by row using PHPExcel? I have a sheet contains more than 100000 rows, but i want to read only 500 rows.
$sheetData = $objP
You can load 500 rows or even setting start index by setting parameters directly to the getRowIterator function.
$path = "Your File Path HERE";
$fileObj = \PHPExcel_IOFactory::load( $path );
$sheetObj = $fileObj->getActiveSheet();
$startFrom = 50; //default value is 1
$limit = 550; //default value is null
foreach( $sheetObj->getRowIterator($startFrom, $limit) as $row ){
foreach( $row->getCellIterator() as $cell ){
$value = $cell->getCalculatedValue();
}
}