PHPackages                             eclipxe/xlsxexporter - 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. eclipxe/xlsxexporter

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

eclipxe/xlsxexporter
====================

PHP Office Open XML Spreadsheet (xlsx) exporter

v2.0.1(10mo ago)57491MITPHPPHP &gt;=7.4CI failing

Since Aug 27Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/eclipxe13/XLSXExporter)[ Packagist](https://packagist.org/packages/eclipxe/xlsxexporter)[ Docs](https://github.com/eclipxe13/XlsxExporter)[ RSS](/packages/eclipxe-xlsxexporter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (21)Used By (1)

`eclipxe/xlsxexporter`
======================

[](#eclipxexlsxexporter)

[![Source Code](https://camo.githubusercontent.com/840da5a043db51db35457e75d57a6cab33d145cd840ee82a22c1c48f5a34d954/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d65636c6970786531332f586c73784578706f727465722d626c75653f6c6f676f3d676974687562)](https://github.com/eclipxe13/XlsxExporter)[![Packagist PHP Version Support](https://camo.githubusercontent.com/cdcc5207d82a55cf7f46f2337771a35dc402630fc30309b11ab831c65cb44f7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f65636c697078652f786c73786578706f727465723f6c6f676f3d706870)](https://packagist.org/packages/eclipxe/xlsxexporter)[![Latest Version](https://camo.githubusercontent.com/5a44ce660824e177a3d8d134d4d9c5d6c2cea57321c1e10ef769187671c75d71/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f65636c6970786531332f586c73784578706f727465723f6c6f676f3d676974)](https://github.com/eclipxe13/XlsxExporter/releases)[![Software License](https://camo.githubusercontent.com/52a6d79018c00117f0b58bfa1928ab01e1c402fe5bfeb3439841e451591250a1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f65636c6970786531332f586c73784578706f727465723f6c6f676f3d6f70656e2d736f757263652d696e6974696174697665)](https://github.com/eclipxe13/XlsxExporter/blob/main/LICENSE)[![Build Status](https://camo.githubusercontent.com/f4cdf37428cd05990bf8e21f8451f3b1a63713662b6dd29f145baf830513b7fe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f65636c6970786531332f586c73784578706f727465722f6275696c642e796d6c3f6272616e63683d6d61696e266c6f676f3d6769746875622d616374696f6e73)](https://github.com/eclipxe13/XlsxExporter/actions/workflows/build.yml?query=branch:main)[![Reliability](https://camo.githubusercontent.com/9a6cd892fb1e73f8df1e614ef0b0bd3f0303df3c6da6a36204f29cf44ca67caa/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d65636c6970786531335f584c53584578706f72746572266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/component_measures?id=eclipxe13_XLSXExporter&metric=Reliability)[![Maintainability](https://camo.githubusercontent.com/2684efc78ff9d7fdd4e48ae7e269888bd96ea112d43515a604194e097afe1e7a/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d65636c6970786531335f584c53584578706f72746572266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/component_measures?id=eclipxe13_XLSXExporter&metric=Maintainability)[![Code Coverage](https://camo.githubusercontent.com/eac3504e07d27c845b401c05759d9f9c0e8646ae3d88c9f19f7bacbad0f8fcf7/68747470733a2f2f696d672e736869656c64732e696f2f736f6e61722f636f7665726167652f65636c6970786531335f584c53584578706f727465722f6d61696e3f6c6f676f3d736f6e617271756265636c6f7564267365727665723d6874747073253341253246253246736f6e6172636c6f75642e696f)](https://sonarcloud.io/component_measures?id=eclipxe13_XLSXExporter&metric=Coverage)[![Violations](https://camo.githubusercontent.com/9a24e13648254c2397558c0b9ed7369b3342f1cd21e8184884c6bfa2b1914624/68747470733a2f2f696d672e736869656c64732e696f2f736f6e61722f76696f6c6174696f6e732f65636c6970786531335f584c53584578706f727465722f6d61696e3f666f726d61743d6c6f6e67266c6f676f3d736f6e617271756265636c6f7564267365727665723d6874747073253341253246253246736f6e6172636c6f75642e696f)](https://sonarcloud.io/project/issues?id=eclipxe13_XLSXExporter&resolved=false)[![Total Downloads](https://camo.githubusercontent.com/a36dc1a9a916590b767b63dbd49ae2e8eb75e20b1dd52bf27aab3d1f4f4675ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65636c697078652f786c73786578706f727465723f6c6f676f3d7061636b6167697374)](https://packagist.org/packages/eclipxe/xlsxexporter)

PHP Office Open XML Spreadsheet (xlsx) Exporter is a project to write xlsx files using PHP. I recommend you to check out the project [PHPExcel](https://github.com/PHPOffice/PHPExcel)that has an excellent support for this kind of files.

I create this project because PHPExcel does not fit my needs. Specifically, I use this tool to export big amount of data to spreadsheets files to be exported and processed by the end user. Using PHPExcel consume a lot of memory and raising the "memory exhausted error".

Projects that does something similar, and I use it as reference:

- [`phpoffice/phpspreadsheet`](https://github.com/PHPOffice/PhpSpreadsheet)
- [`mk-j/php_xlsxwriter`](https://github.com/mk-j/PHP_XLSXWriter)

How it works
------------

[](#how-it-works)

1. Your main object is a workbook.
2. A workbook contains at least 1 spreadsheet.
3. Every spreadsheet (worksheet) has a collection of columns and a DataProvider object.
4. When the structure information (workbook, worksheets, columns and providers) has been set you can write the xlsx file.
5. Every time a worksheet will be created, the headers are written first, then every row of data is written. The data is extracted using the Provider. In this way, you don't need all your data stored on memory, you can use a PDO reader implementing the Provider interface.
6. The data is written to a temporary files (including the final zip), so no large amount of data is being used.

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

[](#installation)

Use [composer](https://getcomposer.org/), run:

```
composer require eclipxe/xlsxexporter
```

Basic usage example
-------------------

[](#basic-usage-example)

```
