Two Laravel devs that won't disappear on you. Finally! Hire Joel and Aaron from No Compromises.

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

Speeding Up Laravel News With Cloudflare image

Speeding Up Laravel News With Cloudflare

Read article
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
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises