I want to generate an Excel template based on the column of a MySQL database. I want the worksheets to be the columns of the Excel file.
How can I achieve that. I am using Laravel
CodePudding user response:
You can use Maatwebsite
It's an excellent package to use excel sheets in Laravel. Go through it's documentation
CodePudding user response:
You should look for a library that does that for you on Packagist.
For example, with maatwebsite/excel, here is a summary of the quick start guide:
- Create an exporter (automatically as shown or manually as in the doc)
php artisan make:export UsersExport --model=User
- Call it where you need it:
Excel::download(new UsersExport, 'users.xlsx');
- Look for
users.xlsx
in/downloads