Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maatwebsite Excel load function not working

$file = $request->file('excel');
$reader = Excel::load($file->getRealPath())->get();

The following error appears:

Call to undefined method Maatwebsite\Excel\Facades\Excel::load()

I am using Maatwebsite 3 in laravel 5.7

like image 842
Md Mahmudul Hasan Emon Avatar asked Aug 30 '25 17:08

Md Mahmudul Hasan Emon


2 Answers

The load method has been removed in version 3.0 (may be re-added in 3.1). Please refer the upgrade guide

ALL Laravel Excel 2.* methods are deprecated and will not be able to use in 3.0 .

  1. Excel::load() is removed and will not be re-added until 3.1
  2. Excel::create() is removed and replaced by Excel::download/Excel::store($yourExport)
  3. v3.0 provides no convenience methods for styling, you are encouraged to use PhpSpreadsheets native methods.
like image 126
Paras Avatar answered Sep 02 '25 12:09

Paras


The load method has been removed as quoted in the las post, however it has been already implemented in 3.1 version.

Excel::load() is removed and replaced by Excel::import($yourImport)

Checkout this link

Personally, I ended it up using Excel::toColletion($file) though.

like image 29
Igor Stephano Avatar answered Sep 02 '25 10:09

Igor Stephano