Jump24 - Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Fast Excel

rap2hpoutre/fast-excel image

Fast Excel stats

Downloads
6.3M
Stars
1,899
Open Issues
74
Forks
234

View on GitHub →

Fast Excel import/export for Laravel

FastExcel: Efficient Excel Import/Export for Laravel

FastExcel is a powerful Laravel package designed to simplify the import and export of Excel, CSV, and ODS files with minimal memory usage. It leverages the capabilities of Spout to provide fast operations, making it an ideal choice for projects where performance is critical.

Key Features

  • Export Models and Collections: Easily export data from Eloquent models or Laravel collections to Excel, CSV, or ODS files.
  • Selective Data Export: Customize exported data by specifying which columns to include.
  • Download Support: Directly download files from a controller, simplifying the export process in web applications.
  • Efficient Imports: Import files directly to Laravel collections, with support for complex configurations such as custom delimiters and encodings.
  • Database Integration: Seamlessly create database entries from imported data.
  • Multiple Sheets: Handle multiple sheets both in imports and exports, with support for named sheets.
  • Memory Efficiency: Export large datasets with minimal memory footprint using generator functions.
  • Styling Options: Customize the style of headers and rows when exporting data.
  • Facade and Global Helper: Integrate FastExcel smoothly with Laravel’s facades and global helpers for more concise code.

Installation

Install FastExcel via Composer:

composer require rap2hpoutre/fast-excel

Usage Examples

Export a User model to an Excel file:

use Rap2hpoutre\FastExcel\FastExcel;
use App\User;
 
$users = User::all();
(new FastExcel($users))->export('file.xlsx');

Import from an Excel file to a collection:

$collection = (new FastExcel)->import('file.xlsx');

Advanced Usage - Export with Chunking:

function usersGenerator() {
foreach (User::cursor() as $user) {
yield $user;
}
}
(new FastExcel(usersGenerator()))->export('test.xlsx');

Conclusion

FastExcel is less feature-rich compared to Laravel Excel but excels in performance, making it suitable for simple tasks requiring high efficiency. It is a faster and memory-friendly alternative for straightforward Excel data handling in Laravel applications.

rap2hpoutre photo

Tinkering @ beta.gouv.fr & fabrique.social.gouv.fr. Stodgy mixture of Rust, JS, PHP, Forth, SQL, GFA Basic, music and more.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Rap2Hpoutre Fast Excel Related Articles

PostgreSQL vs. MongoDB for Laravel: Choosing the Right Database image

PostgreSQL vs. MongoDB for Laravel: Choosing the Right Database

Read article
Lua - Laravel powered open-source URL shortener image

Lua - Laravel powered open-source URL shortener

Read article
Lightweight Spreadsheets for Laravel image

Lightweight Spreadsheets for Laravel

Read article
Our top 10 Laravel Tutorials of 2021 image

Our top 10 Laravel Tutorials of 2021

Read article
Crawl and Index Your Website with Laravel Site Search image

Crawl and Index Your Website with Laravel Site Search

Read article
TastyIgniter: Open Source Restaurant Software image

TastyIgniter: Open Source Restaurant Software

Read article
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum