I'm trying to scan hundreds of folders each containing an excel file.
Here's the simplified workflow
- scan folders in loop
- get first folder name and run it trough some regex (to get some info from the name)
- open the folder and open the excel file inside
- scan excel file for info's (with PHPExcel)
- save everything to Database
Ok so all this is working just fine, except when i run into an excel file which is corrupted.
The problem then is that the PHPEXCEL library cant read it and it throughs back a "Notice: Undefined offset:" and this breaks my foreach loop.
So here is what I'm looking for: a way to somehow skip or something the erros and notices and continue with the next folder and file.
Is there a way? Thank's for any help.
Ok so here is the foreach loop:
foreach ($inputFileName as $key => $fileName) {
$objReader = PHPExcel_IOFactory::load($fileName);
$activeSheet = $objReader->getActiveSheet()->toArray(null,false,true,false);
echo "<pre>";
echo $key;
echo "</pre>";
}
try/catchcan handle the error.