Fast Excel Package for Laravel

Fast Excel Package for Laravel

Fast Excel is a Laravel package for importing and exporting spreadsheets. It provides an elegant wrapper around Spout—a PHP package to read and write spreadsheet files in a quick and scalable way. It is capable of processing large files, all while keeping the memory usage low.

Here’s an example of exporting models or collections to an Excel file:

use Rap2hpoutre\FastExcel\FastExcel;
use App\User;

// Export a User model
$users = User::all();
(new FastExcel($users))->export('file.xlsx');

// Export a collection Collection
$list = collect([
    [ 'id' => 1, 'name' => 'Jane' ],
    [ 'id' => 2, 'name' => 'John' ],
]);

(new FastExcel($list))->export('file.xlsx');

You can use the download method to force the user’s browser to download a file:

return (new FastExcel(User::all()))->download('file.xlsx');

You can also import and export multiple sheets:

$sheets = new SheetCollection([
    User::all(),
    Project::all()
]);
(new FastExcel($sheets))->export('file.xlsx');

Learn More

You can learn more about this package, get full installation instructions, and view the source code on GitHub at rap2hpoutre/fast-excel.

Filed in: Laravel Packages / laravel / packages

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Software Developer
Remote (US & Canada)
Alley
😎 Laravel Developer
Remote
Jogg, Inc
Junior, Mid, and Senior Software Engineers. Laravel / Vue. Saint Petersburg, FL
Saint Petersburg, FL and Remote
ShineOn
Senior PHP Developer (Laravel)
Remote
The Interaction Design Foundation
Fullstack Laravel Engineer (Munich/Remote) 💻
Munich, Germany or Remote
AirLST GmbH