Laravel Excel can't download and export

laravel download export phpexcel laravel-excel

3460 просмотра

2 ответа

My code is copyed from the website.

Excel::create('Filename', function($excel) {

// Set the title
$excel->setTitle('Our new awesome title');

// Chain the setters

  // Call them separately
  $excel->setDescription('A demonstration to change the file properties');

I successfully download once.

However the other try is error.

The error Message is that.

Whoops, looks like something went wrong.

FatalErrorException in LaravelExcelWriter.php line 263:

Call to a member function getMergeCells() on a non-object
in LaravelExcelWriter.php line 263
Автор: 偉年熊 Источник Размещён: 08.11.2019 11:12

Ответы (2)

0 плюса

•   Write following in cmd
composer require Maatwebsite/excel
•   after install /run upper composer........Maalwebsite/excel successfully check in composer.json that 

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "laravelcollective/html": "5.2.*",
        "Maatwebsite/excel": "^2.1"

•   config/app.php/ in provides
•   config/app.php/ in alias
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
•   php artisan vendor:publish
•   php artisan make:controller ExcelController
•   open excel then create first_name,last_name,sex,email,phone then store datas and save as .csv
•   in controlller for import

use App\Customer;
use Input;
use DB;
use Excel;

class ExcelController extends Controller
   public function getImport()
        return view('excel.importCustomer');

    public function postImport()

•   in routes for import

•   In controller for export

    public function getExport()
        Excel::create('Export Data',function($excel) use ($export){
            $excel->sheet('Sheet 1',function($sheet) use ($export){
Автор: Borna Размещён: 20.08.2016 11:27

0 плюса


I know why the reason.

Because there is not any sheet in my case.

However the sheet is necessary.

Thank you.

Автор: 偉年熊 Размещён: 20.08.2016 05:11
Вопросы из категории :