i have this error.
[2019-03-26 08:56:15] local.ERROR: Trying to get property 'Relationship' of non-object {"exception":"[object] (ErrorException(code: 0): Trying to get property 'Relationship' of non-object at /vagrant/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:172) [stacktrace] #0 /vagrant/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(172): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Trying to get p...', '/vagrant/vendor...', 172, Array) #1 /vagrant/vendor/maatwebsite/excel/src/ChunkReader.php(121): PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx->listWorksheetInfo('/tmp/61s9MavVXC...') #2 /vagrant/vendor/maatwebsite/excel/src/ChunkReader.php(29): Maatwebsite\\Excel\\ChunkReader->getTotalRows(Object(PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx), '/tmp/61s9MavVXC...') #3 /vagrant/vendor/maatwebsite/excel/src/Reader.php(91): Maatwebsite\\Excel\\ChunkReader->read(Object(App\\Imports\\CategoryImport), Object(PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx), '/tmp/61s9MavVXC...') #4 /vagrant/vendor/maatwebsite/excel/src/Excel.php(122): Maatwebsite\\Excel\\Reader->read(Object(App\\Imports\\CategoryImport), 'import/category...', 'Xlsx', 'local') #5 /vagrant/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(223): Maatwebsite\\Excel\\Excel->import(Object(App\\Imports\\CategoryImport), 'import/category...', 'local', 'Xlsx') #6 /vagrant/app/Jobs/CategoryImportJob.php(36): Illuminate\\Support\\Facades\\Facade::__callStatic('import', Array) #7 [internal function]: App\\Jobs\\CategoryImportJob->handle() #8 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) #9 /vagrant/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87):
i have five sheet in a excel file and i would like to import only one sheet.
```
public function sheets(): array
{
$this->sheets = [
'sheetname C' => new \App\Imports\Sheets\CategorySheetImport()
];
return $this->sheets;
}
Please have a look at Selecting sheets by worksheet name
Sheets that are not explicitly defined in the sheet() method, will be ignored and thus not be imported.
Sounds like a corrupt or empty excel file
Also getting this error while uploading a large file. I tried using ToModel, WithChunkReading, WithHeadingRow, WithBatchInserts.
I am getting this error too. Not sure why it happened. It works fine local, but once I pack the project to the server. it shows this message. It is not large file or something. I guess server php is missing or disable some kind of extension so this doesn't work.
I had this error while upgrading php version, the curl extensions was missing and not asked by composer (like mbstring, gd, etc...). I only had to install it (php7.x-curl)
我的问题出在excel文件格式错误。
excel文件格式应该是:Excel 工作簿(.xlsx) 或者 Excel 97-2004 工作簿(.xls)
而非:Strict Open XML 电子表格(.xlsx) 等其他格式
Most helpful comment
I am getting this error too. Not sure why it happened. It works fine local, but once I pack the project to the server. it shows this message. It is not large file or something. I guess server php is missing or disable some kind of extension so this doesn't work.