2
votes

What's the best library for laravel to use when it comes to exporting data to an excel file ? something that uses a template would be much better.

2

2 Answers

1
votes

Laravel Excel if you need to add dropdown in your excel sheet PhpSpreadsheet would a good choice over Laravel Excel

For Laravel Excel you can simply

Excel::loadView('folder.file', $data)
->setTitle('FileName')
->sheet('SheetName')
->mergeCells('A2:B2')
->export('xls');
0
votes

Use maatwebsite to Create and import Excel, CSV and PDF files

Add this lines to your composer.json:

"require": {
   "maatwebsite/excel": "~2.1.0"
}

After updating composer, add the ServiceProvider to the providers array in config/app.php

Maatwebsite\Excel\ExcelServiceProvider::class,

You can use the facade for shorter code. Add this to your aliasses:

'Excel' => Maatwebsite\Excel\Facades\Excel::class,

To publish the config settings in Laravel 5 use:

php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"