Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

snehakulal7's avatar

I want to export file to excel

Hello,I want to export file to excel.Even after following the steps which is shown in this link.

https://www.webslesson.info/2018/05/how-to-export-mysql-data-to-excel-file-in-laravel.html

i am getting error like this.

" Call to undefined method Maatwebsite\Excel\Excel::create() "

Guys please help me to solve this.

0 likes
11 replies
Eeetm's avatar

have you declare the Facade Excel ??

like

use Excel;

or

use Maatwebsite\Excel\Facades\Excel;
snehakulal7's avatar

@SIMONPIHLER - Yes i tried,Still,I am getting the same error.

" Call to undefined method Maatwebsite\Excel\Excel::create() "

Is There any other solution???

Thank you

snehakulal7's avatar

@EEETM - Yes i tried with both.Still,I am getting the same error.

" Call to undefined method Maatwebsite\Excel\Excel::create() "

Is There any other solution???

Thank you

simonpihler's avatar
Level 17

On the package website it says:

Deprecations

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

Excel::load() is removed and replaced by Excel::import($yourImport) Excel::create() is removed and replaced by Excel::download/Excel::store($yourExport) 3.0 provides no convenience methods for styling, you are encouraged to use PhpSpreadsheets native methods. You can find an example upgrade for an export here: https://github.com/Maatwebsite/Laravel-Excel/issues/1799

So use downloador storemethod.

Guru5005's avatar

One issue i am facing is Exporting the complex query not possible, some thing like joins and all. there is nothing much given in documentation. Version 2 was Pretty easy. Wasted like 3 days trying to export a custom query. Very frustrating. Still i could not get it to work, finally used PHPExcel package, it's deprecated but works like a charm

1 like

Please or to participate in this conversation.