Weave 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

Excel Laravel Package

maatwebsite/excel

Laravel Excel is an elegant wrapper around PhpSpreadsheet for effortless Excel and CSV imports and exports in Laravel. Export collections and chunked queries, import to models or collections, with clean, readable syntax.

View on GitHub
Deep Wiki
Context7

Laravel Excel is an elegant wrapper around PhpSpreadsheet that brings supercharged Excel and CSV exports and imports to your Laravel application. Export collections or queries directly, or import spreadsheets through clean, expressive APIs.

  • Collection exports — turn any Laravel collection into an Excel or CSV file in seconds
  • Query chunking — export large datasets with automatic chunking for performance
  • Blade exports — build sheets from Blade views with full control over layout
  • Flexible imports — read rows in batches with heading-row mapping and validation
  • Multi-sheet support — organize work across multiple worksheets
Frequently asked questions about Excel
How do I install maatwebsite/excel in Laravel?
Install it with Composer using composer require maatwebsite/excel, then publish the configuration if you need to customize config/excel.php. Basic exports and imports need very little setup because the package is designed natively for Laravel. Pin the exact version you validate, especially when moving to the 4.x line.
Which Laravel and PHP versions does maatwebsite/excel 4.x support?
The package is built for Laravel and 4.x is the current major line, but the 4.x upgrade is a major-version change from 3.1.x. Confirm the PHP and Laravel constraints in composer.json and review the 4.0.0 release notes before upgrading. Do not carry forward 3.x compatibility assumptions without re-validation.
How do I export a Laravel collection or query to Excel with maatwebsite/excel?
Create an export class using Laravel Excel's export concerns, such as FromCollection or FromQuery, and call Excel::download or Excel::store. Exporting queries supports automatic chunking for better performance on large datasets. The public API patterns remain the same in 4.x for the Exportable/Importable and concern-based approach, but re-test after upgrading.
How do I import an Excel or CSV file into a collection or Eloquent model?
Create an import class using ToCollection or ToModel, then pass the file to Excel::import. Laravel's validation rules can be used through import concerns such as WithValidation. For large files, combine imports with chunk reading and queuing.
How do I handle large Excel imports and exports without running out of memory?
Use WithChunkReading for imports and query-based exports with automatic chunking, and queue large jobs instead of processing them in a web request. These features mitigate memory and timeout issues with large files. Also pin PhpSpreadsheet in composer.json and verify the transitive PhpSpreadsheet major paired with Excel 4.x.
Can Laravel Excel exports and imports run in the background using queues?
Yes. Laravel Excel integrates with Laravel queues, so you can dispatch export or import jobs to background workers. This is recommended for large files and helps avoid request timeouts. Use retries and monitoring for failed jobs.
How do I test Excel exports and imports in Laravel?
Use Excel::fake() to mock Excel operations and assert that files were downloaded, stored, or imported. Re-run your test suite against 4.x before merging because it is a major-version upgrade. Also test any custom concerns written against 3.x internals.
What are the breaking changes in Laravel Excel 4.x compared with 3.x?
The supplied details cover 4.0.3, which replaces deprecated SplObjectStorage contains/attach calls with offsetExists internally and has no public API impact. The gating change is 4.0.0, so review its release notes and upgrade guide in full before treating 4.x as a drop-in upgrade. Pin exact versions and re-validate Laravel/PHP constraints, custom concerns, and tests.
Does maatwebsite/excel work with Laravel Octane or serverless deployments?
The package is natively integrated with Laravel and its queue/storage patterns fit typical Laravel deployments, but Octane support for 4.x should be confirmed during re-validation. For serverless or timeout-sensitive workloads, queue large imports and exports and configure timeouts and retries. Monitor failed jobs through Laravel's queue tooling.
What are alternatives to maatwebsite/excel for Excel/CSV handling in Laravel?
Laravel Excel is an elegant wrapper around PhpSpreadsheet, so PhpSpreadsheet directly is the lower-level alternative when you need full control. For simple CSV output, Laravel's native streaming response may be sufficient. Choose based on whether you need styling, formulas, chunking, queue integration, and import-to-model support.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections