0

Hi i am using PHPExcel to import contact in mysql from Excel files. Up until today everything was fine ,when one client wanted to upload excel file. I am using this code to read the excel file :

$filetype = PHPExcel_IOFactory::identify(IEM_STORAGE_PATH . "/import/{$newfilename}");
$objReader = PHPExcel_IOFactory::createReader($filetype);
            $objPHPExcel = $objReader->load(IEM_STORAGE_PATH . "/import/{$newfilename}");

            foreach ($objPHPExcel->getWorksheetIterator() as $worksheet)
            {
                $importinfo['highestRow'] = $worksheet->getHighestRow(); // e.g. 10
                $highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
                $importinfo['highestColumnIndex'] = PHPExcel_Cell::columnIndexFromString($highestColumn);
            }

You can find the excel file here : https://phpexcel.codeplex.com/workitem/20675 . I have spend more than 5 hours trying to solve this problem but nothing has worked so far.

veducm
  • 5,933
  • 2
  • 34
  • 40
  • Welcome! To help others understand your problem, I would suggest your to to explain a bit more the problem that you are facing, include some information of the error, etc. – veducm Jan 27 '14 at 19:51
  • Thanks, the problem is that i don't get any errors.When i try to read the file, variable $objPHPExcel is probably empty.When i try to print it i get errors Warning: mysql_query(): MySQL server has gone away in ... and Warning: mysql_query(): Error reading result set's header in ... and my program brakes ,the errors are not shown in my usual error log. – user3241849 Jan 27 '14 at 20:11
  • Does the load method returns null on error? PHPExcel is written in PHP and it should be possible to find information in its code. – SenseException Jan 27 '14 at 20:49
  • The method does not return no errors that is the main issue.But i fixed this problem by my self with the following code: – user3241849 Jan 27 '14 at 23:02
  • $Reader = PHPExcel_IOFactory::createReaderForFile(IEM_STORAGE_PATH . "/import/{$newfilename}"); $Reader->setReadDataOnly(true); $objXLS = $Reader->load(IEM_STORAGE_PATH . "/import/{$newfilename}"); $value = $objXLS->getSheet(0)->getCell('A1')->getValue(); – user3241849 Jan 27 '14 at 23:03

0 Answers0