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

ActiveSilverstripe-vendormodule

level51/silverstripe-excel-export
=================================

GridField button for excel exports

2.1.0(4mo ago)03.0k↓52.4%6[1 issues](https://github.com/Level51/silverstripe-excel-export/issues)MITPHPPHP ^8.1

Since Mar 12Pushed 4mo ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (7)Used By (0)

SilverStripe GridField button for excel exports
===============================================

[](#silverstripe-gridfield-button-for-excel-exports)

Similar to the default GridFieldExportButton but exports Excel (xlsx) files instead of CSV.

Compat
------

[](#compat)

2.x1.x0.1.xSilverstripe 5, php &gt;= 8.1Silverstripe 4, php &gt;= 7.1Silverstripe 3, php &gt;= 7Howto
-----

[](#howto)

### Styling the exported xlsx file

[](#styling-the-exported-xlsx-file)

You can hook in and style the ready-to-export Excel file with a callback function.

```
$excelExportButton = new GridFieldExcelExportButton('buttons-before-left', $exportFieldMapping);
        $excelExportButton->setAfterExportCallback([ExcelStylingHelper::class, 'styleExcelExport']);
```

The callback passes a subclass of PhpOffice\\PhpSpreadsheet\\Writer\\BaseWriter (e.g. Xlsx writer object), there you can get the spreadsheet and the worksheet and manipulate it. [See PHPSpreadsheet docs fo more details](https://phpspreadsheet.readthedocs.io/en/latest/).

### Setting the default font

[](#setting-the-default-font)

```
class ExcelStylingHelper
{
    public static function styleExcelExport(BaseWriter $writer): void
    {
        $sheet = $writer->getSpreadsheet();
        $sheet->getDefaultStyle()->getFont()->setName('Comic Sans MS');
        $sheet->getDefaultStyle()->getFont()->setSize(12);
    }
}
```

### Draw borders around the exported data

[](#draw-borders-around-the-exported-data)

and a thicker line between header and data

```
        /** @var Worksheet $worksheet */
        $worksheet = $sheet->getActiveSheet();
        $borders = [
            'borders' => [
                'allBorders' => [
                    'borderStyle' => Border::BORDER_MEDIUM,
                    'color' => ['argb' => 'FF000000']
                ]
            ]
        ];
        $bottomRight = $worksheet->getHighestColumn() . $worksheet->getHighestRow();
        $worksheet->getStyle('A1:' . $bottomRight)->applyFromArray($borders);
        $worksheet->getStyle('A1:' . $worksheet->getHighestColumn() . '1')->applyFromArray(
            [
                'borders' => [
                    'bottom' => [
                        'borderStyle' => Border::BORDER_THICK,
                        'color' => ['argb' => 'FF000000']
                    ]
                ]
            ]
        );
```

### Style a specific column

[](#style-a-specific-column)

Sometimes, e.g. telephone numbers are displayed as scientific number. In this case you need to format the content as text.

In this example we check the header row for a specific column named "Tel" and format each cell in this column explicitely as text.

```
        $headerRow = $worksheet->getRowIterator(1, 1)->current();

        foreach ($headerRow->getCellIterator() as $headerCell) {
            //check if header cell is "Tel"
            if ($headerCell->getValue() === 'Tel') {
                //format column as text
                $column = $headerCell->getColumn();
                $worksheet->getStyle($column . ':' . $column)
                    ->getNumberFormat()
                    ->setFormatCode(NumberFormat::FORMAT_TEXT);
                $column = $worksheet->getColumnIterator($column, $column)->current();
                foreach ($column->getCellIterator() as $valueCell) {
                    $valueCell->setValueExplicit(
                        $valueCell->getValue(),
                        DataType::TYPE_STRING
                    );
                }
            }

        }
```

Maintainer
----------

[](#maintainer)

- Daniel Kliemsch
- Julian Scheuchenzuber

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance83

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 60.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 ~532 days

Total

5

Last Release

121d ago

Major Versions

0.1.0 → 1.0.02020-03-12

1.0.1 → 2.0.02024-04-04

PHP version history (3 changes)0.1.0PHP &gt;=7

1.0.0PHP &gt;=7.1

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/441f0e8f95c17048417a33f37e35d5ffdd4c07902cbedaf7f5786f4b7c454284?d=identicon)[JZubero](/maintainers/JZubero)

---

Top Contributors

[![dkliemsch](https://avatars.githubusercontent.com/u/13777159?v=4)](https://github.com/dkliemsch "dkliemsch (14 commits)")[![JZubero](https://avatars.githubusercontent.com/u/13751426?v=4)](https://github.com/JZubero "JZubero (4 commits)")[![wernerkrauss](https://avatars.githubusercontent.com/u/1043925?v=4)](https://github.com/wernerkrauss "wernerkrauss (3 commits)")[![jareddreyerss](https://avatars.githubusercontent.com/u/56658401?v=4)](https://github.com/jareddreyerss "jareddreyerss (1 commits)")[![MLindenhofer](https://avatars.githubusercontent.com/u/68067510?v=4)](https://github.com/MLindenhofer "MLindenhofer (1 commits)")

### Embed Badge

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

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M708](/packages/maatwebsite-excel)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[silverstripe/cms

The SilverStripe Content Management System

5163.4M1.3k](/packages/silverstripe-cms)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[in2code/powermail

Powermail is a well-known, editor-friendly, powerful and easy to use mailform extension for TYPO3 with a lots of features

982.5M38](/packages/in2code-powermail)

PHPackages © 2026

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