phplaravelmaatwebsite-excellaravel-queueexcel-import

(PhpOffice\\PhpSpreadsheet\\Reader\\Exception(code: 0): Could not find zip member laravel queues job - Laravel


I have application created using Laravel 9. i have installed 'maatwebsite/excel' library to export and import excel file. it is working good on local and server. but now i have implemented laravel queue job to run process in background. and excel import is running in background. excel import queue job is working fine on local. but on server it gives error:

PhpOffice\PhpSpreadsheet\Reader\Exception: Could not find zip member zip:///home/abc/public_html/storage/framework/cache/laravel-excel/laravel-excel-IBXMy3FjOUS4zPPBmdTRMctFwRMk31A5.xlsx#_rels/.rels in /home/abc/public_html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php:159

Stack trace: #0 /home/abc/public_html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(400): PhpOffice\PhpSpreadsheet\Shared\File::assertFile()

etc...

Any idea how is not working in queue job and working without queue? Thanks


Solution

  • I found the answer. For queue jobs, we have to specify full path of the file.
    e.g., \Excel::import(new MatchingImport, 'full_path_of_the_file_here');