Write 2 rows, but read only one.

Topics: Developer Forum
Feb 5, 2015 at 9:52 PM
Edited Feb 5, 2015 at 9:53 PM
Hi, I need write an excel file and later read it:
$archivo = public_path('campo/simple.xlsx');
$file  = new PHPExcel();
$file->getProperties()->setCreator("Ejemplo")
                      ->setTitle("Reporte Encuesta 125");
$file->setActiveSheetIndex(0);
$indice = 0;
$file->getActiveSheet()->setCellValue('A1', 'Hello')
    ->setCellValue('A2', 'world!');

$objWriter = PHPExcel_IOFactory::createWriter($file, 'Excel2007');
$objWriter->save( $archivo );

$objReader = PHPExcel_IOFactory::createReader('Excel2007');

$objPHPExcel = $objReader->load($archivo);
$importado = array();
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
    echo "veces <br>";
}
The loop only show one echo. Why?