2

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 Answers 2

1

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');
Sign up to request clarification or add additional context in comments.

8 Comments

Would I be able to use a template ? Because my data contains headers that require merged cells. So, maybe I'm thinking of something that uses a library, or something that can manually merge cells
Call to undefined method Maatwebsite\Excel\Excel::loadView() Already added service providers and aliases
depends on what you have set in your config, please read laravel-excel.maatwebsite.nl/docs/2.1/blade/load-view#docs
What's the purpose of the view btw ? Is it something like, the $data variable will be loaded in the folder.file view, then the output will be the same with the exported excel file ?
if you want to use template, for reports etc... you can make the view, and pass the data to that view
|
0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.