Read Xlsx file in PhpSpreadsheet

前端 未结 4 2189
眼角桃花
眼角桃花 2020-12-15 10:43

I want to read an xlsx file that was created in Microsoft Excel, but when I run the following code...

$Source_File = \"test.xlsx\";
$Spreadsheet         


        
4条回答
  •  一整个雨季
    2020-12-15 11:19

    Use this. It will show the .xlsx

       $inputFileName = public_path('asset/docs/Filename.xlsx');
        
       /** Load $inputFileName to a Spreadsheet Object  **/
       $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
       $writer = IOFactory::createWriter($spreadsheet, 'Html');
       $message = $writer->save('php://output');
    

提交回复
热议问题