PHPackages                             pear/spreadsheet\_excel\_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. pear/spreadsheet\_excel\_writer

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

pear/spreadsheet\_excel\_writer
===============================

Allows writing of Excel spreadsheets without the need for COM objects. Supports formulas, images (BMP) and all kinds of formatting for text and cells.

v0.9.11(7mo ago)441.3M—3.7%622LGPL-2.1-or-laterPHPPHP &gt;=5.6CI passing

Since Feb 19Pushed 5mo ago22 watchersCompare

[ Source](https://github.com/pear/Spreadsheet_Excel_Writer)[ Packagist](https://packagist.org/packages/pear/spreadsheet_excel_writer)[ RSS](/packages/pear-spreadsheet-excel-writer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (11)Used By (2)

[![Continuous Integration](https://github.com/pear/Spreadsheet_Excel_Writer/actions/workflows/ci.yaml/badge.svg)](https://github.com/pear/Spreadsheet_Excel_Writer/actions/workflows/ci.yaml)[![Latest Stable Version](https://camo.githubusercontent.com/47c6c0fe70d359621fb6cd035bed988bc408b3b2baffef3bc13d9733b3f28a09/68747470733a2f2f706f7365722e707567782e6f72672f706561722f73707265616473686565745f657863656c5f7772697465722f762f737461626c65)](https://packagist.org/packages/pear/spreadsheet_excel_writer)[![Coverage Status](https://camo.githubusercontent.com/e4e7cf21955ae3af8aa75ab000b3245586951839c6ddae0a28a8735ffcc8d040/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706561722f53707265616473686565745f457863656c5f5772697465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pear/Spreadsheet_Excel_Writer?branch=master)

Spreadsheet\_Excel\_Writer
==========================

[](#spreadsheet_excel_writer)

This package is [Spreadsheet\_Excel\_Writer](http://pear.php.net/package/Spreadsheet_Excel_Writer) and has been migrated from [svn.php.net](https://svn.php.net/repository/pear/packages/Spreadsheet_Excel_Writer).

Please report all new issues [via the PEAR bug tracker](http://pear.php.net/bugs/search.php?cmd=display&package_name%5B%5D=Spreadsheet_Excel_Writer&order_by=ts1&direction=DESC&status=Open).

If this package is marked as unmaintained and you have fixes, please submit your pull requests and start discussion on the pear-qa mailing list.

Installation
============

[](#installation)

Pear
----

[](#pear)

To test, run

```
$ phpunit

```

To build, simply

```
$ pear package

```

To install from scratch

```
$ pear install package.xml

```

To upgrade

```
$ pear upgrade -f package.xml

```

Composer
--------

[](#composer)

This package comes with support for Composer.

To install from Composer

```
$ composer require pear/spreadsheet_excel_writer

```

To install the latest development version

```
$ composer require pear/spreadsheet_excel_writer:dev-master

```

Features
========

[](#features)

- writing Excel (.XLS) spreadsheets
- support: strings (with formatting for text and cells), formulas, images (BMP)

Limitations
===========

[](#limitations)

Library support only 2 types of format for writing XLS, also known as Binary Interchange File Format ([BIFF](https://www.openoffice.org/sc/excelfileformat.pdf)):

- BIFF5 (Excel 5.0 - Excel 95)
- BIFF8 (Excel 98 - Excel 2003)

**Some important limitations:**

LimitBIFF5BIFF8Maximum number of rows1638465535Maximum number of columns255255Maximum data size of a record2080 bytes8224 bytesUnicode supportCodePage based character encodingUTF-16LEExplanation of formats and specifications you can find [here](https://www.loc.gov/preservation/digital/formats/fdd/fdd000510.shtml) (section "Useful references")

Correct output only guaranteed with `mbstring.func_overload = 0` otherwise, you should use workround `mb_internal_encoding('latin1');`

Usage
=====

[](#usage)

Basic usage
-----------

[](#basic-usage)

```
use Spreadsheet_Excel_Writer;

$filePath = __DIR__ . '/output/out.xls';
$xls = new Spreadsheet_Excel_Writer($filePath);

// 8 = BIFF8
$xls->setVersion(8);

$sheet = $xls->addWorksheet('info');

// only available with BIFF8
$sheet->setInputEncoding('UTF-8');

$headers = [
    'id',
    'name',
    'email',
    'code',
    'address'
];

$row = $col = 0;
foreach ($headers as $header) {
    $sheet->write($row, $col, $header);
    $col++;
}

for ($id = 1; $id < 100; $id++) {
    $data = [
        'id' => $id,
        'name' => 'Name Surname',
        'email' => 'mail@gmail.com',
        'password' => 'cfcd208495d565ef66e7dff9f98764da',
        'address' => '00000 North Tantau Avenue. Cupertino, CA 12345. (000) 1234567'
    ];
    $sheet->writeRow($id, 0, $data);
}

$xls->close();
```

Format usage
------------

[](#format-usage)

```
$xls = new Spreadsheet_Excel_Writer();

$titleFormat = $xls->addFormat();
$titleFormat->setFontFamily('Helvetica');
$titleFormat->setBold();
$titleFormat->setSize(10);
$titleFormat->setColor('orange');
$titleFormat->setBorder(1);
$titleFormat->setBottom(2);
$titleFormat->setBottomColor(44);
$titleFormat->setAlign('center');

$sheet = $xls->addWorksheet('info');

$sheet->write(0, 0, 'Text 123', $titleFormat);
```

Header usage (Sending HTTP header for download dialog)
------------------------------------------------------

[](#header-usage-sending-http-header-for-download-dialog)

```
$xls = new Spreadsheet_Excel_Writer();
$xls->send('excel_'.date("Y-m-d__H:i:s").'.xls');
```

Performance
===========

[](#performance)

**Platform:**
Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
PHP 7.4

**Test case:**
Write xls (BIFF8 format, UTF-8), by 5 cells (1x number, 4x string without format/styles, average line length = 120 char) in each row

**Estimated performance:**

Number of rowsTime (seconds)Peak memory usage (MB)100000.24200000.44300000.66400000.86500001.08655341.28Alternative solutions
=====================

[](#alternative-solutions)

- [PHPOffice/PhpSpreadsheet](https://github.com/PHPOffice/PhpSpreadsheet)
    File formats supported:
- [box/spout](https://github.com/box/spout)
    File formats supported:

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance69

Regular maintenance activity

Popularity55

Moderate usage in the ecosystem

Community37

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Recently: every ~436 days

Total

9

Last Release

216d ago

PHP version history (3 changes)v0.9.4PHP &gt;=5.3.3

v0.9.5PHP &gt;=5.3.3 &lt;7.5

v0.9.7PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/1323714f58f9144af310e5e4217e61b96ad7c42bc5c93a1f2d97deca95f6f4f8?d=identicon)[ashnazg](/maintainers/ashnazg)

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

![](https://www.gravatar.com/avatar/244aa5ea757c09dc227ef8762d2a461d26774995b610c39c252dd12da93ebf2b?d=identicon)[saltybeagle](/maintainers/saltybeagle)

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

---

Top Contributors

[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (61 commits)")[![CloCkWeRX](https://avatars.githubusercontent.com/u/365751?v=4)](https://github.com/CloCkWeRX "CloCkWeRX (14 commits)")[![helgi](https://avatars.githubusercontent.com/u/70530?v=4)](https://github.com/helgi "helgi (7 commits)")[![cweiske](https://avatars.githubusercontent.com/u/59036?v=4)](https://github.com/cweiske "cweiske (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![stdex](https://avatars.githubusercontent.com/u/4608879?v=4)](https://github.com/stdex "stdex (4 commits)")[![c-schmitz](https://avatars.githubusercontent.com/u/1364282?v=4)](https://github.com/c-schmitz "c-schmitz (4 commits)")[![ttgrules](https://avatars.githubusercontent.com/u/1735304?v=4)](https://github.com/ttgrules "ttgrules (3 commits)")[![mj](https://avatars.githubusercontent.com/u/5277?v=4)](https://github.com/mj "mj (3 commits)")[![stevleibelt](https://avatars.githubusercontent.com/u/2287220?v=4)](https://github.com/stevleibelt "stevleibelt (3 commits)")[![till](https://avatars.githubusercontent.com/u/27003?v=4)](https://github.com/till "till (3 commits)")[![roojs](https://avatars.githubusercontent.com/u/415282?v=4)](https://github.com/roojs "roojs (2 commits)")[![fbrinker](https://avatars.githubusercontent.com/u/5345116?v=4)](https://github.com/fbrinker "fbrinker (1 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (1 commits)")[![Bobocato](https://avatars.githubusercontent.com/u/17417724?v=4)](https://github.com/Bobocato "Bobocato (1 commits)")[![caugner](https://avatars.githubusercontent.com/u/495429?v=4)](https://github.com/caugner "caugner (1 commits)")[![coling](https://avatars.githubusercontent.com/u/185346?v=4)](https://github.com/coling "coling (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![dmitryuk](https://avatars.githubusercontent.com/u/661654?v=4)](https://github.com/dmitryuk "dmitryuk (1 commits)")[![alwinkpc](https://avatars.githubusercontent.com/u/3931472?v=4)](https://github.com/alwinkpc "alwinkpc (1 commits)")

---

Tags

excelphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pear-spreadsheet-excel-writer/health.svg)

```
[![Health](https://phpackages.com/badges/pear-spreadsheet-excel-writer/health.svg)](https://phpackages.com/packages/pear-spreadsheet-excel-writer)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[aspera/xlsx-reader

Spreadsheet reader library for XLSX files

52742.2k5](/packages/aspera-xlsx-reader)

PHPackages © 2026

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