PHPackages                             coolsam/excel-import - 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. coolsam/excel-import

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

coolsam/excel-import
====================

Easy imports and exports in FilamentPHP using laravel-excel

v1.2.0(12mo ago)17.9k↓47.3%1[2 PRs](https://github.com/coolsam726/filament-excel-import/pulls)2MITPHPPHP ^8.3CI failing

Since Aug 14Pushed 12mo ago2 watchersCompare

[ Source](https://github.com/coolsam726/filament-excel-import)[ Packagist](https://packagist.org/packages/coolsam/excel-import)[ Docs](https://github.com/coolsam726/filament-excel-import)[ GitHub Sponsors](https://github.com/coolsam)[ RSS](/packages/coolsam-excel-import/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (15)Versions (11)Used By (2)

Easy imports in FilamentPHP using laravel-excel
===============================================

[](#easy-imports-in-filamentphp-using-laravel-excel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a8370636e635d4fe1409acbb66e33ba5170a06ac20b042e11ea685956dd80bae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6f6c73616d2f657863656c2d696d706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coolsam/excel-import)[![GitHub Tests Action Status](https://camo.githubusercontent.com/275ecc81e0d597501ded5cff422543448c2c8807147776a4d76d85024d6c7622/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6f6c73616d3732362f66696c616d656e742d657863656c2d696d706f72742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/coolsam726/filament-excel-import/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/528c4c2056d4a9bc387a936bc6ec4a5a16794f1c496a4835c6132c9f7a2c3d90/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6f6c73616d3732362f66696c616d656e742d657863656c2d696d706f72742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/coolsam726/filament-excel-import/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e3dc7c2d54fc2163a33f339305f7fe38ab11c1b1ba964bf1901f6ba1d3d48947/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6f6c73616d2f657863656c2d696d706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coolsam/excel-import)

This plugin provides user-friendly Filament actions to enable you create data imports and exports using `maatwebsite/excel` at the click of a button.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require coolsam/excel-import
```

You can publish the config file with:

```
php artisan vendor:publish --tag="coolsam-excel-config"
```

This is the contents of the published config file:

```
return [
    'accepted_mimes' => [
        'application/vnd.ms-excel',
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        'text/csv',
        'text/plain',
        'csv',
        'txt',
    ],
    'temporary_files' => [
        'disk' => 'local',
        'directory' => 'coolsam-excel',
    ],
];
```

Usage
=====

[](#usage)

Imports:
--------

[](#imports)

The package provides two types of Actions for importing records: Page Action and Table Action.

### Using Page Actions in the List Page:

[](#using-page-actions-in-the-list-page)

Add the following import action in your resource list page, e.g ListUsers

```
    use Coolsam\FilamentExcel\Actions\ImportAction;
    use Coolsam\FilamentExcel\Actions\ImportField;
    protected function getHeaderActions(): array
    {
        return [
            ImportAction::make('users')->fields([
                ImportField::make('name')->required(),
                ImportField::make('email')->required(),
            ]),
            ... ,// Other Actions
        ];
    }
```

### Using the table Action in your resource Class:

[](#using-the-table-action-in-your-resource-class)

Chain the following into your $table variable in the Resource class. This is also useful in case you would like to import child records in a relation manager class. Note that the Action import part is different.

```
use Coolsam\FilamentExcel\Actions\ImportField;
use Coolsam\FilamentExcel\Actions\Tables\ImportAction;

    $table->headerActions([
        ImportAction::make('import users')
            ->fields([
                ImportField::make('name')->required(),
                ImportField::make('email')->required(),
            ])->uniqueField('email')
            ->createRecordUsing(fn($data) => User::updateOrCreate(
                ['email' => $data['email']],
                $data
            ))
    ])
```

### Unique field:

[](#unique-field)

In case you would like to skip some records which already exist in the DB, you will have to specify a unique field to check for checking existin fields.

```
    $table->headerActions([
        ImportAction::make('import users')
            ->fields([
                ImportField::make('name')->required(),
                ImportField::make('email')->required(),
            ])->uniqueField('email')
            ->createRecordUsing(fn($data) => User::updateOrCreate(
                ['email' => $data['email']],
                $data
            ))
    ])
```

### Manually handle the record creation process:

[](#manually-handle-the-record-creation-process)

You probably love to be in control, and would like to create the record on your own, given the data. Here is how:

```
    $table->headerActions([
        ImportAction::make('import users')
            ->fields([
                ImportField::make('name')->required(),
                ImportField::make('email')->required(),
            ])->createRecordUsing(fn($data) => User::updateOrCreate(
                ['email' => $data['email']],
                $data
            ))
    ])
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Sam Maosa](https://github.com/coolsam726)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance50

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~92 days

Recently: every ~161 days

Total

8

Last Release

363d ago

Major Versions

v1.0.0-beta.2 → 3.x-dev2023-08-14

PHP version history (2 changes)v1.0.0-beta.0PHP ^8.1

v1.2.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5610289?v=4)[Sam Maosa](/maintainers/coolsam726)[@coolsam726](https://github.com/coolsam726)

---

Top Contributors

[![awcodes](https://avatars.githubusercontent.com/u/3596800?v=4)](https://github.com/awcodes "awcodes (41 commits)")[![coolsam726](https://avatars.githubusercontent.com/u/5610289?v=4)](https://github.com/coolsam726 "coolsam726 (24 commits)")[![zepfietje](https://avatars.githubusercontent.com/u/44533235?v=4)](https://github.com/zepfietje "zepfietje (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (13 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![ryangjchandler](https://avatars.githubusercontent.com/u/41837763?v=4)](https://github.com/ryangjchandler "ryangjchandler (6 commits)")[![lucasgiovanny](https://avatars.githubusercontent.com/u/4853801?v=4)](https://github.com/lucasgiovanny "lucasgiovanny (1 commits)")[![Z3d0X](https://avatars.githubusercontent.com/u/75579178?v=4)](https://github.com/Z3d0X "Z3d0X (1 commits)")[![cheesegrits](https://avatars.githubusercontent.com/u/934456?v=4)](https://github.com/cheesegrits "cheesegrits (1 commits)")

---

Tags

laravelexcelcoolsam

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/coolsam-excel-import/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

9963.4M12](/packages/spatie-laravel-pdf)[guava/filament-knowledge-base

A filament plugin that adds a knowledge base and help to your filament panel(s).

206120.5k1](/packages/guava-filament-knowledge-base)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[avadim/fast-excel-laravel

Lightweight and very fast XLSX Excel Spreadsheet Export/Import for Laravel

4146.7k1](/packages/avadim-fast-excel-laravel)[guava/filament-modal-relation-managers

Allows you to embed relation managers inside filament modals.

7565.0k4](/packages/guava-filament-modal-relation-managers)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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