Running PHP on App Engine, Laravel 5.1.
The app is failing on \Excel::load($path); statement but afterwards when I look at the App Engine storage path the file is there. Here is the code:
$file = $file->move($destPath,$filename);
$path = $file->getPathname();
if (in_array($file->getExtension(), ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt'])){
$newFile = \Excel::load($path); //FAILS HERE
$info = $newFile->store('csv', storage_path('imports'), true);
\File::delete($path);
$path = $info['full'];
}
I tried putting a sleep between the file->move statement but that didn't have any effect.
Any suggestions would be appreciated.
Since this was first posted here's what we've tried.
- We tried uploading a spreadsheet directly (by passing the $file->move) and loading that. Didn't work.
- On the theory the Open Office was writing a file that wasn't compatible, we tried a file that was save using Excel. Didn't work.
- On the theory that an Excel5 file didn't work, we tried Excel2007. Didn't work.
- Tested a simple fopen, fget, fseek. That worked.
Here's the stack trace.
in Excel2007.php line 82
at PHPExcel_Reader_Excel2007->canRead('/base/data/home/apps/s~populous-2-0/20170914t111153.404103259874586280/gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx') in FormatIdentifier.php line 249
at FormatIdentifier->canRead('Excel2007', '/base/data/home/apps/s~populous-2-0/20170914t111153.404103259874586280/gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx') in FormatIdentifier.php line 51
at FormatIdentifier->getFormatByFile('/base/data/home/apps/s~populous-2-0/20170914t111153.404103259874586280/gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx') in LaravelExcelReader.php line 1341
at LaravelExcelReader->_setFormat() in LaravelExcelReader.php line 777
at LaravelExcelReader->_init('gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx', null, false) in LaravelExcelReader.php line 275
at LaravelExcelReader->load('gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx', null, false, null) in Excel.php line 119
at Excel->load('gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx') in Facade.php line 215
at Facade::__callStatic('load', array('gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx')) in StaffController.php line 173
at Excel::load('gs://populous-2-0.appspot.com/storage/imports/staff_import_17_1505402010.xlsx') in StaffController.php line 173