See rates for the top Laravel developers in Latin America

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
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Tinkerwell logo

Tinkerwell

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

Tinkerwell