PHPackages                             totalcrm/excel-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. totalcrm/excel-bundle

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

totalcrm/excel-bundle
=====================

This is a Symfony4 Bundle helps you to read and write Excel files (including pdf, xlsx, odt), thanks to the PHPExcel library

v2.2.5(4y ago)0218MITPHPPHP &gt;=7.2

Since Sep 28Pushed 4y agoCompare

[ Source](https://github.com/totalcrm/excel-bundle)[ Packagist](https://packagist.org/packages/totalcrm/excel-bundle)[ Docs](http://www.welcometothebundle.com)[ RSS](/packages/totalcrm-excel-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (21)Used By (0)

Symfony4 Excel bundle
=====================

[](#symfony4-excel-bundle)

### Things to know:

[](#things-to-know)

CSV is faster so if you have to create simple xls file, I encourage you to use the built-in function for csv: [http://php.net/manual-lookup.php?pattern=csv&amp;lang=en&amp;scope=quickref](http://php.net/manual-lookup.php?pattern=csv&lang=en&scope=quickref)

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

[](#installation)

**1** Add to composer.json to the `require` key

```
    $composer require totalcrm/excel-bundle
```

**2** Register the bundle in `app/AppKernel.php`

```
    $bundles = array(
        // ...
        new TotalCRM\ExcelBundle\TotalCRMExcelBundle(),
    );
```

TL;DR
-----

[](#tldr)

- Create an empty object:

```
$phpExcelObject = $this->get('phpexcel')->createPHPExcelObject();
```

- Create an object from a file:

```
$phpExcelObject = $this->get('phpexcel')->createPHPExcelObject('file.xls');
```

- Create a Excel5 and write to a file given the object:

```
$writer = $this->get('phpexcel')->createWriter($phpExcelObject, 'Excel5');
$writer->save('file.xls');
```

- Create a Excel5 and create a StreamedResponse:

```
$writer = $this->get('phpexcel')->createWriter($phpExcelObject, 'Excel5');
$response = $this->get('phpexcel')->createStreamedResponse($writer);
```

- Create a Excel file with an image:

```
$writer = $this->get('phpexcel')->createPHPExcelObject();
$writer->setActiveSheetIndex(0);
$activesheet = $writer->getActiveSheet();

$drawingobject = $this->get('phpexcel')->createPHPExcelWorksheetDrawing();
$drawingobject->setName('Image name');
$drawingobject->setDescription('Image description');
$drawingobject->setPath('/path/to/image');
$drawingobject->setHeight(60);
$drawingobject->setOffsetY(20);
$drawingobject->setCoordinates('A1');
$drawingobject->setWorksheet($activesheet)
```

Not Only 'Excel5'
-----------------

[](#not-only-excel5)

The list of the types are:

1. 'Excel5'
2. 'Excel2007'
3. 'Excel2003XML'
4. 'OOCalc'
5. 'SYLK'
6. 'Gnumeric'
7. 'HTML'
8. 'CSV'

Example
-------

[](#example)

### Fake Controller

[](#fake-controller)

The best place to start is the fake Controller at `Tests/app/Controller/FakeController.php`, that is a working example.

### More example

[](#more-example)

You could find a lot of examples in the official PHPExcel repository

### For lazy devs

[](#for-lazy-devs)

```
namespace YOURNAME\YOURBUNDLE\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;

class DefaultController extends Controller
{

    public function indexAction($name)
    {
        // ask the service for a Excel5
       $phpExcelObject = $this->get('phpexcel')->createPHPExcelObject();

       $phpExcelObject->getProperties()->setCreator("totalcrm")
           ->setLastModifiedBy("Giulio De Donato")
           ->setTitle("Office 2005 XLSX Test Document")
           ->setSubject("Office 2005 XLSX Test Document")
           ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
           ->setKeywords("office 2005 openxml php")
           ->setCategory("Test result file");
       $phpExcelObject->setActiveSheetIndex(0)
           ->setCellValue('A1', 'Hello')
           ->setCellValue('B2', 'world!');
       $phpExcelObject->getActiveSheet()->setTitle('Simple');
       // Set active sheet index to the first sheet, so Excel opens this as the first sheet
       $phpExcelObject->setActiveSheetIndex(0);

        // create the writer
        $writer = $this->get('phpexcel')->createWriter($phpExcelObject, 'Excel5');
        // create the response
        $response = $this->get('phpexcel')->createStreamedResponse($writer);
        // adding headers
        $dispositionHeader = $response->headers->makeDisposition(
            ResponseHeaderBag::DISPOSITION_ATTACHMENT,
            'stream-file.xls'
        );
        $response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8');
        $response->headers->set('Pragma', 'public');
        $response->headers->set('Cache-Control', 'maxage=1');
        $response->headers->set('Content-Disposition', $dispositionHeader);

        return $response;
    }
}
```

Contribute
----------

[](#contribute)

1. fork the project
2. clone the repo
3. get the coding standard fixer: `wget http://cs.sensiolabs.org/get/php-cs-fixer.phar`
4. before the PullRequest you should run the coding standard fixer with `php php-cs-fixer.phar fix -v .`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 72.1% 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 ~189 days

Recently: every ~4 days

Total

19

Last Release

1571d ago

Major Versions

v0.0.8 → v1.0.02012-09-28

v1.0.6 → v2.0.0-RC12013-12-06

PHP version history (2 changes)v0.0.8PHP &gt;=5.3.2

v2.2.1PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15926848?v=4)[TotalCRM](/maintainers/TotalCRM)[@totalcrm](https://github.com/totalcrm)

---

Top Contributors

[![liuggio](https://avatars.githubusercontent.com/u/530406?v=4)](https://github.com/liuggio "liuggio (101 commits)")[![totalcrm](https://avatars.githubusercontent.com/u/15926848?v=4)](https://github.com/totalcrm "totalcrm (7 commits)")[![szchen77](https://avatars.githubusercontent.com/u/1326435?v=4)](https://github.com/szchen77 "szchen77 (4 commits)")[![renatomefi](https://avatars.githubusercontent.com/u/823634?v=4)](https://github.com/renatomefi "renatomefi (4 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (3 commits)")[![sethunath](https://avatars.githubusercontent.com/u/905031?v=4)](https://github.com/sethunath "sethunath (2 commits)")[![gnat42](https://avatars.githubusercontent.com/u/325591?v=4)](https://github.com/gnat42 "gnat42 (1 commits)")[![jebbench](https://avatars.githubusercontent.com/u/1029732?v=4)](https://github.com/jebbench "jebbench (1 commits)")[![lemoinem](https://avatars.githubusercontent.com/u/234992?v=4)](https://github.com/lemoinem "lemoinem (1 commits)")[![lvancrayelynghe](https://avatars.githubusercontent.com/u/1170965?v=4)](https://github.com/lvancrayelynghe "lvancrayelynghe (1 commits)")[![mmoreram](https://avatars.githubusercontent.com/u/521409?v=4)](https://github.com/mmoreram "mmoreram (1 commits)")[![mussbach](https://avatars.githubusercontent.com/u/57546580?v=4)](https://github.com/mussbach "mussbach (1 commits)")[![nursultanturdaliev](https://avatars.githubusercontent.com/u/1384060?v=4)](https://github.com/nursultanturdaliev "nursultanturdaliev (1 commits)")[![oscargala](https://avatars.githubusercontent.com/u/1231556?v=4)](https://github.com/oscargala "oscargala (1 commits)")[![pauvos](https://avatars.githubusercontent.com/u/984187?v=4)](https://github.com/pauvos "pauvos (1 commits)")[![ryzy](https://avatars.githubusercontent.com/u/994940?v=4)](https://github.com/ryzy "ryzy (1 commits)")[![s4brown](https://avatars.githubusercontent.com/u/1057294?v=4)](https://github.com/s4brown "s4brown (1 commits)")[![Vrtak-CZ](https://avatars.githubusercontent.com/u/112567?v=4)](https://github.com/Vrtak-CZ "Vrtak-CZ (1 commits)")[![Anyqax](https://avatars.githubusercontent.com/u/3055796?v=4)](https://github.com/Anyqax "Anyqax (1 commits)")[![waldo2188](https://avatars.githubusercontent.com/u/841872?v=4)](https://github.com/waldo2188 "waldo2188 (1 commits)")

---

Tags

symfonybundleexcelxls

### Embed Badge

![Health badge](/badges/totalcrm-excel-bundle/health.svg)

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

###  Alternatives

[liuggio/excelbundle

This is a Symfony2 Bundle helps you to read and write Excel files (including pdf, xlsx, odt), thanks to the PHPExcel library

3776.4M10](/packages/liuggio-excelbundle)[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)[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)[jgrygierek/sonata-batch-entity-import-bundle

Importing entities with preview and edit features for Sonata Admin.

10951.2k](/packages/jgrygierek-sonata-batch-entity-import-bundle)

PHPackages © 2026

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