PHPackages                             jimmy0699/fast-excel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. jimmy0699/fast-excel

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

jimmy0699/fast-excel
====================

Fast Excel import/export for Laravel

v3.3.4(3y ago)07.1k↓50%MITPHPPHP ^8.0

Since Apr 5Pushed 3y agoCompare

[ Source](https://github.com/jimmy0699/excel)[ Packagist](https://packagist.org/packages/jimmy0699/fast-excel)[ RSS](/packages/jimmy0699-fast-excel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (59)Used By (0)

[![](https://user-images.githubusercontent.com/36028424/40173202-9a03d68a-5a03-11e8-9968-6b7e3b4f8a1b.png)](https://user-images.githubusercontent.com/36028424/40173202-9a03d68a-5a03-11e8-9968-6b7e3b4f8a1b.png)

[![Version](https://camo.githubusercontent.com/88690c0753c669bde9c175a8366e801c198e77cb860649f76a50fb1eed6dd515/68747470733a2f2f706f7365722e707567782e6f72672f7261703268706f757472652f666173742d657863656c2f76657273696f6e3f666f726d61743d666c6174)](https://packagist.org/packages/rap2hpoutre/fast-excel)[![License](https://camo.githubusercontent.com/b51908ff8146800b12ffa3c89bf64d99a69d9061e0859ba35f2e9d3bc329cf46/68747470733a2f2f706f7365722e707567782e6f72672f7261703268706f757472652f666173742d657863656c2f6c6963656e73653f666f726d61743d666c6174)](https://packagist.org/packages/rap2hpoutre/fast-excel)[![Build Status](https://camo.githubusercontent.com/15c551371af1469015184373597fe87adfe0169d3fa3c52c5c4c1c42ba6c7eab/68747470733a2f2f7472617669732d63692e6f72672f7261703268706f757472652f666173742d657863656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rap2hpoutre/fast-excel)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e511e29bd57781cba9a6f4f961f9fc1d7c448fc883e54d136fe995765fffeb92/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7261703268706f757472652f666173742d657863656c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rap2hpoutre/fast-excel/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/6dd5c1ace940e93b1dd4b9163d35138afe1ebdd302dd36631e93b0c114cff29e/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6261653332643931353536653436316662376430666439333439356563366161)](https://www.codacy.com/gh/rap2hpoutre/fast-excel/dashboard?utm_source=github.com&utm_medium=referral&utm_content=rap2hpoutre/fast-excel&utm_campaign=Badge_Grade)[![Total Downloads](https://camo.githubusercontent.com/6f2e8f59fde016298c7d6bcc8c7a0c6b028b34301b2700980ae6c278e05b3988/68747470733a2f2f706f7365722e707567782e6f72672f7261703268706f757472652f666173742d657863656c2f646f776e6c6f616473)](https://packagist.org/packages/rap2hpoutre/fast-excel)

Fast Excel import/export for Laravel, thanks to [Spout](https://github.com/box/spout). See [benchmarks](#benchmarks) below.

Quick start
-----------

[](#quick-start)

Install via composer:

```
composer require rap2hpoutre/fast-excel

```

Export a Model to `.xlsx` file:

```
use Rap2hpoutre\FastExcel\FastExcel;
use App\User;

// Load users
$users = User::all();

// Export all users
(new FastExcel($users))->export('file.xlsx');
```

Export
------

[](#export)

Export a Model or a **Collection**:

```
$list = collect([
    [ 'id' => 1, 'name' => 'Jane' ],
    [ 'id' => 2, 'name' => 'John' ],
]);

(new FastExcel($list))->export('file.xlsx');
```

Export `xlsx`, `ods` and `csv`:

```
$invoices = App\Invoice::orderBy('created_at', 'DESC')->get();
(new FastExcel($invoices))->export('invoices.csv');
```

Export only some attributes specifying columns names:

```
(new FastExcel(User::all()))->export('users.csv', function ($user) {
    return [
        'Email' => $user->email,
        'First Name' => $user->firstname,
        'Last Name' => strtoupper($user->lastname),
    ];
});
```

Download (from a controller method):

```
return (new FastExcel(User::all()))->download('file.xlsx');
```

Import
------

[](#import)

`import` returns a Collection:

```
$collection = (new FastExcel)->import('file.xlsx');
```

Import a `csv` with specific delimiter, enclosure characters and "gbk" encoding:

```
$collection = (new FastExcel)->configureCsv(';', '#', 'gbk')->import('file.csv');
```

Import and insert to database:

```
$users = (new FastExcel)->import('file.xlsx', function ($line) {
    return User::create([
        'name' => $line['Name'],
        'email' => $line['Email']
    ]);
});
```

Facades
-------

[](#facades)

You may use FastExcel with the optional Facade. Add the following line to `config/app.php` under the `aliases` key.

```
'FastExcel' => Rap2hpoutre\FastExcel\Facades\FastExcel::class,
```

Using the Facade, you will not have access to the constructor. You may set your export data using the `data` method.

```
$list = collect([
    [ 'id' => 1, 'name' => 'Jane' ],
    [ 'id' => 2, 'name' => 'John' ],
]);

FastExcel::data($list)->export('file.xlsx');
```

Global helper
-------------

[](#global-helper)

FastExcel provides a convenient global helper to quickly instantiate the FastExcel class anywhere in a Laravel application.

```
$collection = fastexcel()->import('file.xlsx');
fastexcel($collection)->export('file.xlsx');
```

Advanced usage
--------------

[](#advanced-usage)

### Export multiple sheets

[](#export-multiple-sheets)

Export multiple sheets by creating a `SheetCollection`:

```
$sheets = new SheetCollection([
    User::all(),
    Project::all()
]);
(new FastExcel($sheets))->export('file.xlsx');
```

Use index to specify sheet name:

```
$sheets = new SheetCollection([
    'Users' => User::all(),
    'Second sheet' => Project::all()
]);
```

### Import multiple sheets

[](#import-multiple-sheets)

Import multiple sheets by using `importSheets`:

```
$sheets = (new FastExcel)->importSheets('file.xlsx');
```

You can also import a specific sheet by its number:

```
$users = (new FastExcel)->sheet(3)->import('file.xlsx');
```

Import multiple sheets with sheets names:

```
$sheets = (new FastExcel)->withSheetsNames()->importSheets('file.xlsx');
```

### Export large collections with chunk

[](#export-large-collections-with-chunk)

Export rows one by one to avoid `memory_limit` issues [using `yield`](https://www.php.net/manual/en/language.generators.syntax.php):

```
function usersGenerator() {
    foreach (User::cursor() as $user) {
        yield $user;
    }
}

// Export consumes only a few MB, even with 10M+ rows.
(new FastExcel(usersGenerator()))->export('test.xlsx');
```

### Add header and rows style

[](#add-header-and-rows-style)

Add header and rows style with `headerStyle` and `rowsStyle` methods.

```
$header_style = (new StyleBuilder())->setFontBold()->build();

$rows_style = (new StyleBuilder())
    ->setFontSize(15)
    ->setShouldWrapText()
    ->setBackgroundColor("EDEDED")
    ->build();

return (new FastExcel($list))
    ->headerStyle($header_style)
    ->rowsStyle($rows_style)
    ->download('file.xlsx');
```

Why?
----

[](#why)

FastExcel is intended at being Laravel-flavoured [Spout](https://github.com/box/spout): a simple, but elegant wrapper around [Spout](https://github.com/box/spout) with the goal of simplifying **imports and exports**. It could be considered as a faster (and memory friendly) alternative to [Laravel Excel](https://laravel-excel.com/), with less features. Use it only for simple tasks.

Benchmarks
----------

[](#benchmarks)

> Tested on a MacBook Pro 2015 2,7 GHz Intel Core i5 16 Go 1867 MHz DDR3. Testing a XLSX export for 10000 lines, 20 columns with random data, 10 iterations, 2018-04-05. **Don't trust benchmarks.**

Average memory peak usageExecution timeLaravel Excel123.56 M11.56 sFastExcel2.09 M2.76 sStill, remember that [Laravel Excel](https://laravel-excel.com/) **has many more features.**

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~27 days

Total

56

Last Release

1454d ago

Major Versions

v0.12.0 → v1.0.02019-01-02

v1.7.0 → v2.0.02020-06-16

v2.5.0 → v3.0.02021-05-01

PHP version history (4 changes)v0.10.1PHP ^7.0

v2.2.0PHP ^7.1

v2.3.0PHP ^7.1|^8.0

v3.3.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2d46f49d4ee4218c60be0f295e7e5edc8e6922552de68045b80ba39372e4286?d=identicon)[DorienCragen](/maintainers/DorienCragen)

---

Top Contributors

[![rap2hpoutre](https://avatars.githubusercontent.com/u/1575946?v=4)](https://github.com/rap2hpoutre "rap2hpoutre (130 commits)")[![johanrosenson](https://avatars.githubusercontent.com/u/10432296?v=4)](https://github.com/johanrosenson "johanrosenson (5 commits)")[![Pochwar](https://avatars.githubusercontent.com/u/9018038?v=4)](https://github.com/Pochwar "Pochwar (2 commits)")[![markdieselcore](https://avatars.githubusercontent.com/u/16547382?v=4)](https://github.com/markdieselcore "markdieselcore (2 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (2 commits)")[![gocep](https://avatars.githubusercontent.com/u/1003500?v=4)](https://github.com/gocep "gocep (1 commits)")[![imxd](https://avatars.githubusercontent.com/u/17986878?v=4)](https://github.com/imxd "imxd (1 commits)")[![IvAndrew](https://avatars.githubusercontent.com/u/15038813?v=4)](https://github.com/IvAndrew "IvAndrew (1 commits)")[![jpmurray](https://avatars.githubusercontent.com/u/1550428?v=4)](https://github.com/jpmurray "jpmurray (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![mashkovtsevlx](https://avatars.githubusercontent.com/u/9170009?v=4)](https://github.com/mashkovtsevlx "mashkovtsevlx (1 commits)")[![micalm](https://avatars.githubusercontent.com/u/9348336?v=4)](https://github.com/micalm "micalm (1 commits)")[![mokhosh](https://avatars.githubusercontent.com/u/6499685?v=4)](https://github.com/mokhosh "mokhosh (1 commits)")[![pushchris](https://avatars.githubusercontent.com/u/679974?v=4)](https://github.com/pushchris "pushchris (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![shoutoutloud](https://avatars.githubusercontent.com/u/21352046?v=4)](https://github.com/shoutoutloud "shoutoutloud (1 commits)")[![squatto](https://avatars.githubusercontent.com/u/748444?v=4)](https://github.com/squatto "squatto (1 commits)")[![vocolboy](https://avatars.githubusercontent.com/u/6601427?v=4)](https://github.com/vocolboy "vocolboy (1 commits)")[![AlirezaSedghi](https://avatars.githubusercontent.com/u/8061051?v=4)](https://github.com/AlirezaSedghi "AlirezaSedghi (1 commits)")[![zarunet](https://avatars.githubusercontent.com/u/43345608?v=4)](https://github.com/zarunet "zarunet (1 commits)")

---

Tags

laravelexcelxlsxlsxcsv

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jimmy0699-fast-excel/health.svg)

```
[![Health](https://phpackages.com/badges/jimmy0699-fast-excel/health.svg)](https://phpackages.com/packages/jimmy0699-fast-excel)
```

###  Alternatives

[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k24.9M47](/packages/rap2hpoutre-fast-excel)[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M709](/packages/maatwebsite-excel)[emiliogrv/nova-batch-load

A Laravel Nova XLS &amp; CSV importer

1641.8k](/packages/emiliogrv-nova-batch-load)[jgrygierek/batch-entity-import-bundle

Importing entities with preview and edit features for Symfony.

101.1M1](/packages/jgrygierek-batch-entity-import-bundle)[seine/seine

Seine - Write spreadsheets of various formats to a stream

1270.3k](/packages/seine-seine)[nilgems/laravel-textract

A Laravel package to extract text from files like DOC, XL, Image, Pdf and more. I've developed this package by inspiring "npm textract".

195.2k](/packages/nilgems-laravel-textract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
