home | heroImage | actionText | actionLink | features | footer | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
true |
/assets/img/logo-small.png |
Read documentation → |
/3.1/getting-started/ |
|
MIT Licensed | Powered by Maatwebsite |
💡 Install the package via composer
.
composer require maatwebsite/excel
💪 Create an export and import class.
php artisan make:export UsersExport --model=App\\User
php artisan make:import UsersImport --model=App\\User
🔥 Download your export and import your file.
<?php
use App\Exports\UsersExport;
use App\Imports\UsersImport;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Controllers\Controller;
class UsersController extends Controller
{
public function export()
{
return Excel::download(new UsersExport, 'users.xlsx');
}
public function import()
{
return Excel::import(new UsersImport, 'users.xlsx');
}
}