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
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
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
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
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
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
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media