Given:
$this->objPHPExcelReader = PHPExcel_IOFactory::createReaderForFile($this->config[\'file\']);
$this->objPHPExcelReader->setLoadSheetsOnly(a
I suggest to convert excel to array, clean it from empty elements and then count the number of columns:
protected function getColumnsCheck($file, $col_number) {
if (strstr($file, ".xls") != false && strstr($file, ".xlsx") != false) {
$fileType = PHPExcel_IOFactory::identify($file);
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objPHPExcel = $objReader->load($file);
$columns_empty = $objPHPExcel->getActiveSheet(0)->toArray()[0];
$columns = array_filter($columns_empty);
return ($col_number==count($columns));
}
return false;
}