Laravel Excel导入找不到邮政编码错误

发布于 2025-02-10 01:29:26 字数 1488 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

怕倦 2025-02-17 01:29:26

我通过配置文件名如下解决了问题。

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

        return back();
    }

I solved the problem by configuring the filename as follows.

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

        return back();
    }
沉溺在你眼里的海 2025-02-17 01:29:26

就我而言,它显示出此错误,因为现有的Excel是空的。一旦您填充一个牢房,它的工作就可以了。

    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');
    

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');
    
爱你不解释 2025-02-17 01:29:26

错误的某些原因找不到zip成员如果您使用laravel excel package(或phpexcel)可能是您处理文件导入laravel排队 ,只需使用排队的阅读解决方案。与此讨论的错误相似的一个示例在这里

如果没有任何帮助,请使用替代软件包 simplexlsx or/and/and/and/and/and simplexls

Some of reason of error Could not find zip member if you use Laravel Excel package (or PHPExcel) may be that you handle file import inside Laravel Queued Job, just use Queued reading solution. An example of error similar to this discussed here.

If nothing helps, use alternative package SimpleXLSX or/and SimpleXLS

赠意 2025-02-17 01:29:26

如果您的XLSX文件受密码保护,则必须先删除密码。否则也将报告此错误。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文