PHPackages                             yectep/phpspreadsheet-bundle - 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. yectep/phpspreadsheet-bundle

ActiveSymfony-bundle[PDF &amp; Document Generation](/categories/documents)

yectep/phpspreadsheet-bundle
============================

A Symfony bundle to integrate with PHPOffice's PhpSpreadsheet library

v1.1.0(2y ago)562.3M↓15%25[7 issues](https://github.com/eightyknots/phpspreadsheet-bundle/issues)[1 PRs](https://github.com/eightyknots/phpspreadsheet-bundle/pulls)4MITPHPPHP &gt;=7.2

Since Feb 14Pushed 2y ago4 watchersCompare

[ Source](https://github.com/eightyknots/phpspreadsheet-bundle)[ Packagist](https://packagist.org/packages/yectep/phpspreadsheet-bundle)[ RSS](/packages/yectep-phpspreadsheet-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (13)Used By (4)

PhpSpreadsheetBundle
====================

[](#phpspreadsheetbundle)

This bundle integrates your Symfony 4/5/6/7 app with the PHPOffice PhpSpreadsheet productivity library.

Requirements
------------

[](#requirements)

This bundle requires, in addition to prerequisites of each PHPOffice library:

```
* PHP 7.2 or higher
* Symfony 4 or higher

```

Note: Tags older than v1.0.0 (e.g. v0.2.0) are no longer supported due to deprecated status for both PHP &lt;= 7.1 and Symfony &lt;= 4.4.

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

[](#installation)

Use composer to require the latest stable version.

```
composer require yectep/phpspreadsheet-bundle
```

If you're not using Flex, enable the bundle in your `AppKernel.php` or `bundles.php` file.

```
$bundles = array(
    [...]
    new Yectep\PhpSpreadsheetBundle\PhpSpreadsheetBundle(),
);
```

Usage
-----

[](#usage)

This bundle enables the `phpoffice.spreadsheet` service.

See also the official [PHPOffice PhpSpreadsheet documentation](http://phpspreadsheet.readthedocs.io/).

### createSpreadsheet()

[](#createspreadsheet)

Creates an empty `\PhpOffice\PhpSpreadsheet\Spreadsheet` object, or, if an optional `$filename` is passed, instantiates the `\PhpOffice\PhpSpreadsheet\IOFactory` to automatically detect and use the appropriate `IWriter` class to read the file.

```
// In your controller
$newSpreadsheet = $this->get('phpoffice.spreadsheet')->createSpreadsheet();
$existingXlsx   = $this->get('phpoffice.spreadsheet')->createSpreadsheet('/path/to/file.xlsx');
```

### createReader(`string` $type)

[](#createreaderstring-type)

Returns an instance of the `\PhpOffice\PhpSpreadsheet\Reader` class of the given `$type`.

Types are case sensitive. Supported types are:

- `Xlsx`: Excel 2007
- `Xls`: Excel 5/BIFF (95)
- `Xml`: Excel 2003 XML
- `Slk`: Symbolic Link (SYLK)
- `Ods`: Open/Libre Office (ODS)
- `Csv`: CSV
- `Html`: HTML

```
$readerXlsx  = $this->get('phpoffice.spreadsheet')->createReader('Xlsx');
$spreadsheet = $readerXlsx->load('/path/to/file.xlsx');
```

### createWriter(`Spreadsheet` $spreadsheet, `string` $type)

[](#createwriterspreadsheet-spreadsheet-string-type)

Given a `\PhpOffice\PhpSpreadsheet\Spreadsheet` object and a writer `$type`, returns an instance of a `\PhpOffice\PhpSpreadsheet\Writer` class for that type.

In addition the the read types above, these types are additionally supported for writing, if the appropriate PHP libraries are installed.

- `Tcpdf`
- `Mpdf`
- `Dompdf`

```
$spreadsheet = $this->get('phpoffice.spreadsheet')->createSpreadsheet();
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Hello world');

$writerXlsx = $this->get('phpoffice.spreadsheet')->createWriter($spreadsheet, 'Xlsx');
$writerXlsx->save('/path/to/destination.xlsx');
```

Roadmap and Contributions
-------------------------

[](#roadmap-and-contributions)

Contributions are more than welcome. Fork the project, and submit a PR when you're done.

Remaining todos include:

- Tests and test coverage
- TravisCI
- Improved documentation

Symfony serializer
------------------

[](#symfony-serializer)

If you are migrating from Symfony Serializer component + CSV encoder - you can use code like

```
$spreadsheet = $this->get('phpoffice.spreadsheet')->createSpreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle($this->filterVars['wareCategory']->getTitle());
$columnsMap = [];
$lineIndex = 2;
foreach ($data as $line) {
   foreach ($line as $columnName=>$columnValue) {
       if (is_int($columnIndex = array_search($columnName, $columnsMap))) {
           $columnIndex++;
       } else {
           $columnsMap[] = $columnName;
           $columnIndex = count($columnsMap);
       }
       $sheet->getCellByColumnAndRow($columnIndex, $lineIndex)->setValue($columnValue);
   }
   $lineIndex++;
}
foreach ($columnsMap as $columnMapId=>$columnTitle) {
   $sheet->getCellByColumnAndRow($columnMapId+1, 1)->setValue($columnTitle);
}
$writer = $this->get('phpoffice.spreadsheet')->createWriter($spreadsheet, 'Xlsx');
ob_start();
$writer->save('php://output');
$excelOutput = ob_get_clean();

return new Response(
   $excelOutput,
   200,
   [
       'content-type'        =>  'text/x-csv; charset=windows-1251',
       'Content-Disposition' => 'attachment; filename="price.xlsx"'
   ]
);
```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community28

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

Recently: every ~353 days

Total

11

Last Release

896d ago

Major Versions

v0.2.0 → v1.0.02022-01-20

PHP version history (2 changes)v0.0.1PHP &gt;=5.6

v1.0.0PHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![eightyknots](https://avatars.githubusercontent.com/u/660703?v=4)](https://github.com/eightyknots "eightyknots (10 commits)")[![andrea-daru](https://avatars.githubusercontent.com/u/8058905?v=4)](https://github.com/andrea-daru "andrea-daru (5 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (3 commits)")[![zhil](https://avatars.githubusercontent.com/u/981783?v=4)](https://github.com/zhil "zhil (2 commits)")[![Dodenis](https://avatars.githubusercontent.com/u/39649301?v=4)](https://github.com/Dodenis "Dodenis (2 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (2 commits)")[![LJaschinski](https://avatars.githubusercontent.com/u/11751408?v=4)](https://github.com/LJaschinski "LJaschinski (1 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (1 commits)")[![pekkast](https://avatars.githubusercontent.com/u/1282829?v=4)](https://github.com/pekkast "pekkast (1 commits)")[![qdequippe](https://avatars.githubusercontent.com/u/3193300?v=4)](https://github.com/qdequippe "qdequippe (1 commits)")[![g-g](https://avatars.githubusercontent.com/u/765134?v=4)](https://github.com/g-g "g-g (1 commits)")[![goodjinny](https://avatars.githubusercontent.com/u/13361839?v=4)](https://github.com/goodjinny "goodjinny (1 commits)")

---

Tags

excelofficephp-librarysymfonysymfony-bundle

### Embed Badge

![Health badge](/badges/yectep-phpspreadsheet-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/yectep-phpspreadsheet-bundle/health.svg)](https://phpackages.com/packages/yectep-phpspreadsheet-bundle)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[roromix/spreadsheetbundle

This is a Symfony 7.1+ Bundle helps you to read and write Spreadsheet files (including pdf, xls, xlsx, odt, csv), thanks to the PHPSpreadsheet library

24410.2k1](/packages/roromix-spreadsheetbundle)[jgrygierek/batch-entity-import-bundle

Importing entities with preview and edit features for Symfony.

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

Symfony Bundle to read or write Excel file (including pdf, xlsx, odt), using phpoffice/phpspreadsheet library (replacement of phpoffice/phpexcel, abandonned)

15332.0k](/packages/onurb-excel-bundle)[bfinlay/laravel-excel-seeder

Seed the database with Laravel using Excel, XLSX, XLS, CSV, ODS, Gnumeric, XML, HTML, SLK files

3944.4k](/packages/bfinlay-laravel-excel-seeder)[egyg33k/csv-bundle

Integration of League CSV into Symfony

1027.1k](/packages/egyg33k-csv-bundle)

PHPackages © 2026

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