PHPackages                             baagee/xlsx-writer - 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. baagee/xlsx-writer

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

baagee/xlsx-writer
==================

PHP Library to write XLSX files

v0.41(5y ago)015MITPHPPHP &gt;=5.2.1

Since Oct 23Pushed 5y agoCompare

[ Source](https://github.com/baagee/PHP_XLSXWriter)[ Packagist](https://packagist.org/packages/baagee/xlsx-writer)[ Docs](https://github.com/baagee/PHP_XLSXWriter)[ RSS](/packages/baagee-xlsx-writer/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (14)Used By (0)

PHP\_XLSXWriter
===============

[](#php_xlsxwriter)

Forked from [https://github.com/mk-j/PHP\_XLSXWriter](https://github.com/mk-j/PHP_XLSXWriter) Add namespace

This library is designed to be lightweight, and have minimal memory usage.

It is designed to output an Excel compatible spreadsheet in (Office 2007+) xlsx format, with just basic features supported:

- supports PHP 5.2.1+
- takes UTF-8 encoded input
- multiple worksheets
- supports currency/date/numeric cell formatting, simple formulas
- supports basic cell styling
- supports writing huge 100K+ row spreadsheets

Install: composer require baagee/xlsx-writer

Simple PHP CLI example:

```
$data = array(
    array('year','month','amount'),
    array('2003','1','220'),
    array('2003','2','153.5'),
);

$writer = new \BaAGee\Excel\XLSXWriter();
$writer->writeSheet($data);
$writer->writeToFile('output.xlsx');
```

Simple/Advanced Cell Formats:

```
$header = array(
  'created'=>'date',
  'product_id'=>'integer',
  'quantity'=>'#,##0',
  'amount'=>'price',
  'description'=>'string',
  'tax'=>'[$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00',
);
$data = array(
    array('2015-01-01',873,1,'44.00','misc','=D2*0.05'),
    array('2015-01-12',324,2,'88.00','none','=D3*0.05'),
);

$writer = new \BaAGee\Excel\XLSXWriter();
$writer->writeSheetHeader('Sheet1', $header );
foreach($data as $row)
	$writer->writeSheetRow('Sheet1', $row );
$writer->writeToFile('example.xlsx');
```

50000 rows: (1.4s, 0MB memory usage)

```
$writer = new \BaAGee\Excel\XLSXWriter();
$writer->writeSheetHeader('Sheet1', array('c1'=>'integer','c2'=>'integer','c3'=>'integer','c4'=>'integer') );
for($i=0; $iwriteSheetRow('Sheet1', array($i, $i+1, $i+2, $i+3) );
}
$writer->writeToFile('huge.xlsx');
echo '#'.floor((memory_get_peak_usage())/1024/1024)."MB"."\n";
```

rowstimememory500001.4s0MB1000002.7s0MB1500004.1s0MB2000005.7s0MB2500007.0s0MBSimple cell formats map to more advanced cell formats

simple formatsformat codestring@integer0dateYYYY-MM-DDdatetimeYYYY-MM-DD HH:MM:SStimeHH:MM:SSprice\#,##0.00dollar\[$$-1009\]#,##0.00;\[RED\]-\[$$-1009\]#,##0.00euro\#,##0.00 \[$€-407\];\[RED\]-#,##0.00 \[$€-407\]Basic cell styles have been available since version 0.30

styleallowed valuesfontArial, Times New Roman, Courier New, Comic Sans MSfont-size8,9,10,11,12 ...font-stylebold, italic, underline, strikethrough or multiple ie: 'bold,italic'borderleft, right, top, bottom, or multiple ie: 'top,left'border-stylethin, medium, thick, dashDot, dashDotDot, dashed, dotted, double, hair, mediumDashDot, mediumDashDotDot, mediumDashed, slantDashDotborder-color\#RRGGBB, ie: #ff99cc or #f9ccolor\#RRGGBB, ie: #ff99cc or #f9cfill\#RRGGBB, ie: #eeffee or #efehaligngeneral, left, right, justify, centervalignbottom, center, distributed

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72% 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 ~173 days

Recently: every ~226 days

Total

13

Last Release

2136d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f3a062d2e991897f0a7441d4e002bb5be5217948bed92461ab08174f7134c1f?d=identicon)[baagee](/maintainers/baagee)

---

Top Contributors

[![mk-j](https://avatars.githubusercontent.com/u/2347256?v=4)](https://github.com/mk-j "mk-j (116 commits)")[![Radstake](https://avatars.githubusercontent.com/u/1010097?v=4)](https://github.com/Radstake "Radstake (13 commits)")[![andrewkesper](https://avatars.githubusercontent.com/u/14990339?v=4)](https://github.com/andrewkesper "andrewkesper (5 commits)")[![ivanbarlog](https://avatars.githubusercontent.com/u/2583610?v=4)](https://github.com/ivanbarlog "ivanbarlog (3 commits)")[![jpastoor](https://avatars.githubusercontent.com/u/733306?v=4)](https://github.com/jpastoor "jpastoor (3 commits)")[![sebastiankalwa](https://avatars.githubusercontent.com/u/8233667?v=4)](https://github.com/sebastiankalwa "sebastiankalwa (2 commits)")[![c-schmitz](https://avatars.githubusercontent.com/u/1364282?v=4)](https://github.com/c-schmitz "c-schmitz (2 commits)")[![GoktugOzturk](https://avatars.githubusercontent.com/u/1000956?v=4)](https://github.com/GoktugOzturk "GoktugOzturk (2 commits)")[![lieszkol](https://avatars.githubusercontent.com/u/16566226?v=4)](https://github.com/lieszkol "lieszkol (1 commits)")[![lourdas](https://avatars.githubusercontent.com/u/397916?v=4)](https://github.com/lourdas "lourdas (1 commits)")[![Malvineous](https://avatars.githubusercontent.com/u/171656?v=4)](https://github.com/Malvineous "Malvineous (1 commits)")[![marktinsley](https://avatars.githubusercontent.com/u/303598?v=4)](https://github.com/marktinsley "marktinsley (1 commits)")[![ShinyChang](https://avatars.githubusercontent.com/u/1590707?v=4)](https://github.com/ShinyChang "ShinyChang (1 commits)")[![stephane-rouleau](https://avatars.githubusercontent.com/u/27228998?v=4)](https://github.com/stephane-rouleau "stephane-rouleau (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")[![unamatasanatarai](https://avatars.githubusercontent.com/u/3831251?v=4)](https://github.com/unamatasanatarai "unamatasanatarai (1 commits)")[![baagee](https://avatars.githubusercontent.com/u/22995500?v=4)](https://github.com/baagee "baagee (1 commits)")[![EOM](https://avatars.githubusercontent.com/u/1219132?v=4)](https://github.com/EOM "EOM (1 commits)")[![farhantahir](https://avatars.githubusercontent.com/u/15313084?v=4)](https://github.com/farhantahir "farhantahir (1 commits)")[![fliespl](https://avatars.githubusercontent.com/u/1256832?v=4)](https://github.com/fliespl "fliespl (1 commits)")

---

Tags

phplibraryexcelxlsxlsx

### Embed Badge

![Health badge](/badges/baagee-xlsx-writer/health.svg)

```
[![Health](https://phpackages.com/badges/baagee-xlsx-writer/health.svg)](https://phpackages.com/packages/baagee-xlsx-writer)
```

###  Alternatives

[mk-j/php_xlsxwriter

PHP Library to write XLSX files

1.9k8.1M27](/packages/mk-j-php-xlsxwriter)[avadim/fast-excel-writer

Lightweight and very fast XLSX Excel Spreadsheet Writer in PHP

2951.2M7](/packages/avadim-fast-excel-writer)[avadim/fast-excel-reader

Lightweight and very fast XLSX Excel Spreadsheet Reader in PHP

104608.4k6](/packages/avadim-fast-excel-reader)[avadim/fast-excel-templator

Lightweight and very fast Excel Spreadsheet generator from XLSX-templates in PHP

20106.6k](/packages/avadim-fast-excel-templator)[maksimovic/php-xlsx-writer

PHP Library to write XLSX files

1143.0k](/packages/maksimovic-php-xlsx-writer)

PHPackages © 2026

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