Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Fast Excel Laravel Package

rap2hpoutre/fast-excel

Fast, memory-efficient Excel/CSV/ODS import/export for Laravel using Spout. Export Eloquent models or collections to XLSX/CSV/ODS with custom column mapping, and download from controllers. Import files to collections, configure CSV options, or transform rows into DB inserts.

View on GitHub
Deep Wiki
Context7

Fast Excel import/export for Laravel

Frequently asked questions about Fast Excel
How does FastExcel compare to Laravel Excel in terms of performance for large datasets?
FastExcel outperforms Laravel Excel significantly, especially for large datasets. It uses Spout v3 for streaming and chunked processing, keeping memory usage low (e.g., 2MB peak for 1M+ rows) compared to Laravel Excel’s 123MB+ overhead. It’s ideal for high-volume exports like monthly reports or bulk data dumps.
Can I use FastExcel to export Eloquent relationships or nested data?
FastExcel focuses on flat exports of Eloquent models or Collections. For nested relationships, you’ll need to flatten the data manually in a callback before exporting. If you need complex Excel features like multi-sheet relationships, consider Laravel Excel or PhpSpreadsheet instead.
What Laravel versions does FastExcel support, and is it compatible with PHP 8?
FastExcel requires **Laravel 8+** and **PHP 8.0+**. It drops support for older PHP versions due to Spout v3’s requirements. If you’re on PHP 7.4 or below, you’ll need to upgrade or use Laravel Excel as an alternative.
How do I customize CSV delimiters, encodings, or enclosures for imports?
Use the `configureCsv()` method to set delimiters, enclosures, and encodings before importing. For example, `(new FastExcel)->configureCsv(';', '#', 'gbk')->import('file.csv')` handles German-style CSVs with semicolon delimiters and GBK encoding.
Does FastExcel support multi-sheet Excel exports like PhpSpreadsheet?
FastExcel supports **multiple sheets** via `SheetCollection`, but it’s less feature-rich than PhpSpreadsheet. For advanced Excel features like charts, formulas, or complex formatting, you’ll need to use PhpSpreadsheet or Laravel Excel instead.
How can I handle large exports that exceed PHP’s memory limit?
Use **chunked exports** with Eloquent’s `cursor()` method or yield rows in a callback. For example, `(new FastExcel(User::cursor()))->export('large_file.xlsx')` processes data in chunks, avoiding memory spikes. Monitor `memory_limit` in staging for edge cases.
Is FastExcel suitable for background jobs or queued exports?
Yes! FastExcel integrates seamlessly with Laravel Queues. Dispatch a job to handle large exports asynchronously, avoiding timeouts. Example: `ExportJob::dispatch(User::all())`, where the job uses `(new FastExcel($users))->export('path.xlsx')`.
Can I map imported CSV rows directly to database inserts without loading everything into memory?
Yes, use the import callback to process rows incrementally. For example, `(new FastExcel)->import('file.csv', function ($line) { User::create($line); })` inserts records row-by-row without loading the entire file into memory.
What are the alternatives if FastExcel lacks advanced Excel features like formulas or charts?
For advanced Excel features, use **Laravel Excel** (built on PhpSpreadsheet) or **PhpSpreadsheet directly**. FastExcel prioritizes speed and simplicity over feature richness, making it ideal for bulk data operations where formatting isn’t critical.
How do I install and set up FastExcel in a Laravel project?
Install via Composer: `composer require rap2hpoutre/fast-excel`. No additional configuration is needed. Use it directly in controllers or services, e.g., `(new FastExcel(User::all()))->download('users.xlsx')` for exports or `(new FastExcel)->import('file.xlsx')` for imports.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai