3

I installed Laravel excel and created a form. I have completed all the configurations related to Laravel excel. I select and upload my excel file in the form I created, and then I get the following error.

PHP Version: 8.1.7
Laravel Version: 9.11

PHP Info
Zip enabled
Zip version 1.19.5
Libzip headers version 1.8.0
Libzip library version 1.9.0

 Could not find zip member zip:///Users/dev/Sites/exaan/storage/framework/cache/laravel-excel/laravel-excel-s3kqNFqinyEPG6SJRC6c3HA1qKfCW0Bk.xlsx#_rels/.rels
alihancibooglu
  • 167
  • 2
  • 10

3 Answers3

5

I solved the problem by configuring the filename as follows.

public function importPost()
    {
        Excel::import(new AccountStatementsImport, $request->file('file')->store('temp'));

        return back();
    }
alihancibooglu
  • 167
  • 2
  • 10
0

in my case it showed this error because the existing Excel was empty. As soon you fill a cell its working.

    use PhpOffice\PhpSpreadsheet\Spreadsheet;
    use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
    use PhpOffice\PhpSpreadsheet\IOFactory;        


    $inputFileType = 'Xlsx';
    $inputFileName = '../storage/app/templates/template.xlsx';

    
    /**  Create a new Reader of the type defined in $inputFileType  **/
    $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
    
    /**  Load $inputFileName to a Spreadsheet Object  **/
    $spreadsheet = $reader->load($inputFileName);

    $sheet = $spreadsheet->getActiveSheet();
    
    //Edit the cell values
    $sheet->setCellValue('A1', 'Hello');
    $sheet->setCellValue('B2', 'World!');

    $writer = new Xlsx($spreadsheet);
    
    $writer->save('../storage/app/temp/world4.xlsx');
    
Joe Doe
  • 11
  • 2
0

if your xlsx file had be protected by password, You must remove the password first. or it would be report this error too.