PHPackages                             lekoala/silverstripe-excel-import-export - 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. lekoala/silverstripe-excel-import-export

ActiveSilverstripe-vendormodule[PDF &amp; Document Generation](/categories/documents)

lekoala/silverstripe-excel-import-export
========================================

Replace CSV with Excel in SilverStripe

4.0.0(7mo ago)89.5k↓48.4%102MITPHPPHP ^8.3CI passing

Since Jan 23Pushed 2mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (38)Used By (2)

SilverStripe Excel Import Export module
=======================================

[](#silverstripe-excel-import-export-module)

[![Build Status](https://github.com/lekoala/silverstripe-excel-import-export/actions/workflows/ci.yml/badge.svg)](https://github.com/lekoala/silverstripe-excel-import-export/actions/workflows/ci.yml/badge.svg)[![scrutinizer](https://camo.githubusercontent.com/bf481ee818903f47718382d3d3dc93093c99fe200ed819aac64ef8de56e7343d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c656b6f616c612f73696c7665727374726970652d657863656c2d696d706f72742d6578706f72742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lekoala/silverstripe-excel-import-export/)[![codecov](https://camo.githubusercontent.com/2e7d6324b52a5e785cdc31226b3742aef1b6519eac81d48def59e88afd2342b4/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6c656b6f616c612f73696c7665727374726970652d657863656c2d696d706f72742d6578706f72743f746f6b656e3d39773448636670346543)](https://codecov.io/gh/lekoala/silverstripe-excel-import-export)

Intro
-----

[](#intro)

Add import/export functionalities in xlsx format. Also replace built in csv import/export to have the same consistent behaviour. Excel support is provided by `spread-compat` package which can use under the hood simple xlsx, php spreadsheet or openspout.

These changes apply automatically to SecurityAdmin and ModelAdmin through extension.

To make import easier, import specs are replaced by a sample file that is ready to use for the user. This import file can be further customised by implementing `sampleImportData` that should return an array of rows.

Choosing your adapter
---------------------

[](#choosing-your-adapter)

You can choose your preferred adapter in yml. Accepted values are:

- csv: PhpSpreadsheet,OpenSpout,League,Native
- xlsx: PhpSpreadsheet,OpenSpout,Simple,Native

```
LeKoala\ExcelImportExport\ExcelImportExport:
  preferred_csv_adapter: 'Native'
  preferred_xlsx_adapter: 'Native'
```

Configure exported fields
-------------------------

[](#configure-exported-fields)

All fields are exported by default (not just summary fields that are useless by themselves)

If you want to restrict the fields, you can either:

- Implement a `exportedFields` method on your model that should return an array of fields
- Define a `exported_fields` config field on your model that will restrict the list to these fields
- Define a `unexported_fields` config field on your model that will blacklist these fields from being exported

Custom import handlers
----------------------

[](#custom-import-handlers)

If you define a `listImportHandlers` you can define a list of custom handlers that your user can choose instead of the default process.

These handler may or may not enable the `onlyUpdate` feature that will prevent creating new records. This needs to be handled in your own import classes by adding a `setOnlyUpdate` method.

This require some custom code on your `ModelAdmin` class that could look like this

```
   public function import($data, $form, $request)
    {
        if (!ExcelImportExport::checkImportForm($this)) {
            return false;
        }
        $handler = $data['ImportHandler'] ?? null;
        if ($handler == "default") {
            return parent::import($data, $form, $request);
        }
        return ExcelImportExport::useCustomHandler($handler, $form, $this);
    }
```

The import handlers only need to implement a `load` method that needs to return a result string or a `BulkLoader_Result` object.

These custom handlers can have a custom description and a custom sample file:

```
    public static function getImportDescription()
    {
        return "This is my custom description";
    }

    public static function getSampleFileLink()
    {
        return ExcelImportExport::createDownloadSampleLink(__CLASS__);
    }

    public static function getSampleFile()
    {
        $data = []; // TODO
        ExcelImportExport::createSampleFile($data, __CLASS__);
    }
```

Compatibility
-------------

[](#compatibility)

Tested with ^5 and up

Maintainer
----------

[](#maintainer)

LeKoala -

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance75

Regular maintenance activity

Popularity34

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.9% 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 ~82 days

Recently: every ~60 days

Total

37

Last Release

74d ago

Major Versions

1.0.0 → 2.0.02018-05-23

1.1.0 → 2.0.22020-04-22

2.1.3 → 3.0.02024-01-05

2.1.4 → 3.0.62024-05-30

3.1.9 → 4.0.02025-09-26

PHP version history (6 changes)1.0.0PHP &gt;=5.4.8

2.0.0PHP &gt;=5.6

2.0.1PHP &gt;=7

2.1.0PHP ^7.4 || ^8.0

3.0.0PHP ^8.1

4.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/250762?v=4)[Thomas Portelange](/maintainers/lekoala)[@lekoala](https://github.com/lekoala)

---

Top Contributors

[![lekoala](https://avatars.githubusercontent.com/u/250762?v=4)](https://github.com/lekoala "lekoala (130 commits)")[![AljosaB](https://avatars.githubusercontent.com/u/1818329?v=4)](https://github.com/AljosaB "AljosaB (2 commits)")[![micschk](https://avatars.githubusercontent.com/u/1005986?v=4)](https://github.com/micschk "micschk (2 commits)")[![t3hn0](https://avatars.githubusercontent.com/u/4533442?v=4)](https://github.com/t3hn0 "t3hn0 (2 commits)")[![TheBnl](https://avatars.githubusercontent.com/u/1334195?v=4)](https://github.com/TheBnl "TheBnl (1 commits)")[![RVXD](https://avatars.githubusercontent.com/u/1586761?v=4)](https://github.com/RVXD "RVXD (1 commits)")[![Fernando-Larios](https://avatars.githubusercontent.com/u/5921131?v=4)](https://github.com/Fernando-Larios "Fernando-Larios (1 commits)")[![dpezer](https://avatars.githubusercontent.com/u/1654953?v=4)](https://github.com/dpezer "dpezer (1 commits)")

---

Tags

phpexcelphpspreadsheetsilverstripeexportsilverstripeexcelimportcmsmodule

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lekoala-silverstripe-excel-import-export/health.svg)

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

###  Alternatives

[arogachev/yii2-excel

ActiveRecord import and export based on PHPExcel for Yii 2 framework

6480.3k1](/packages/arogachev-yii2-excel)[3x1io/filament-excel

Excel Export for Resources

224.2k1](/packages/3x1io-filament-excel)

PHPackages © 2026

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