¿Cómo determino el final del archivo usando la biblioteca PHPExcel en un bucle de fragmentos?

Usando la biblioteca PHPExcel, estoy intentando iterar alrededor de 1500 filas, cada fila tiene aproximadamente 25 columnas.

Estoy usando este código (tomado dePHPExcel se queda sin 256, 512 y también 1024 MB de RAM):

/**  Create a new Reader of the type defined in $inputFileType  **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/**  Define how many rows we want to read for each "chunk"  **/ 
$chunkSize = 20;
/**  Create a new Instance of our Read Filter  **/ 
$chunkFilter = new chunkReadFilter(); 
/**  Tell the Reader that we want to use the Read Filter that we've Instantiated  **/ 
$objReader->setReadFilter($chunkFilter); 

/**  Loop to read our worksheet in "chunk size" blocks  **/ 
/**  $startRow is set to 2 initially because we always read the headings in row #1  **/
for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) { 
    /**  Tell the Read Filter, the limits on which rows we want to read this iteration        **/ 
$chunkFilter->setRows($startRow,$chunkSize); 
/**  Load only the rows that match our filter from $inputFileName to a PHPExcel Object  **/ 
$objPHPExcel = $objReader->load($inputFileName); 
//    Do some processing here 

//    Free up some of the memory 
$objPHPExcel->disconnectWorksheets(); 
unset($objPHPExcel); 

}

Quiero procesar tantas filas tienen datos. Intenté usar el método getHighestRow () del objeto Hoja de trabajo, pero seguía devolviendo A1

Traté también de verificar si la siguiente fila recuperada estaba vacía escribiendo esta pequeña función:

function _emptyRow($row) {
    $empty=true;

    foreach($row as $r) {
    if ($r!='') {
        $empty = false;
        }
    }

    return $empty;

}

Así que si _emptyRow () lo harébreak fuera de la lupa . Esto no funcionó para mí.

¿Alguien puede sugerir una forma de recuperar solo todos los registros que tienen datos? Cuando ejecuto esto, aunque solo alrededor de 1500 filas tienen datos, llega a aproximadamente 23000 antes de que se agote el tiempo de espera (con set_time_limit (240));

Respuestas a la pregunta(4)

Su respuesta a la pregunta