How to debug why cell values are empty?

Topics: User Forum
Feb 7, 2014 at 8:12 AM
Edited Feb 7, 2014 at 8:20 AM
I start with these code
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
$cacheSettings = array( 'memoryCacheSize' => '128MB');
$cacheEnabled = PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
if (!$cacheEnabled)
{
            # WARNING - Cache to php temp not enableable ###" . PHP_EOL;
}
$inputFileType = PHPExcel_IOFactory::identify($file_path);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);  
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($file_path);
$objWorksheet   = $objPHPExcel->setActiveSheetIndex(0); 
Then
$highestRow = $objWorksheet->getHighestRow();
returns 2560. Ok, I've an excel with 2560 rows populated.

Then I loop
for ($x =1; $x<=$highestRow; $x++)  // here $x plus plus ...
{
   $ean                = $objWorksheet->getCellByColumnAndRow(15, $row)->getValue();
   $description        = $objWorksheet->getCellByColumnAndRow(13, $row)->getValue();
   echo $ean .":" .$description . PHP_EOL;
}
But every row is empty, only 2560 ":" are printed.

So I'd like to dump entire row because I really cannot understand why returned value are empty! Every single cell of sheet, from A to BC, from 1 to 2560, are filled with some value.

Why empty?
How to debug?
Coordinator
Feb 7, 2014 at 9:51 AM
Perhaps either:
for ($x =1; $x<=$highestRow; $x++) 
{
   $ean                = $objWorksheet->getCellByColumnAndRow(15, $x)->getValue();
   $description        = $objWorksheet->getCellByColumnAndRow(13, $x)->getValue();
   echo $ean .":" .$description . PHP_EOL;
}
or
for ($row =1; $row<=$highestRow; $row++) 
{
   $ean                = $objWorksheet->getCellByColumnAndRow(15, $row)->getValue();
   $description        = $objWorksheet->getCellByColumnAndRow(13, $row)->getValue();
   echo $ean .":" .$description . PHP_EOL;
}
Feb 7, 2014 at 2:55 PM
Oh ... what a stupid ... sorry for this waste of time ...