skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    I solved the problem by configuring the filename as follows.

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

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

        use PhpOfficePhpSpreadsheetSpreadsheet;
        use PhpOfficePhpSpreadsheetWriterXlsx;
        use PhpOfficePhpSpreadsheetIOFactory;        
    
    
        $inputFileType = 'Xlsx';
        $inputFileName = '../storage/app/templates/template.xlsx';
    
        
        /**  Create a new Reader of the type defined in $inputFileType  **/
        $reader = PhpOfficePhpSpreadsheetIOFactory::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');
        
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search