PhpSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to read from and to write to different spreadsheet file formats, like Excel and LibreOffice Calc.
PhpSpreadsheet alternatives and similar libraries
Based on the "Office" category.
Alternatively, view PhpSpreadsheet alternatives based on common mentions on social networks and blogs.
9.4 8.6 L3 PhpSpreadsheet VS PHPWordA pure PHP library for reading and writing word processing documents
7.5 6.5 L2 PhpSpreadsheet VS PHPPowerPointA pure PHP library for reading and writing presentations documents
2.7 0.0 L5 PhpSpreadsheet VS ExcelAntSimple yet powerful Excel manipulation library for PHP 5.4+
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of PhpSpreadsheet or a related project?
PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc.
PHP version support
LTS: Support for PHP versions will only be maintained for a period of six months beyond the end of life of that PHP version.
Currently the required PHP minimum version is PHP 7.3.
composer.json for other requirements.
Use composer to install PhpSpreadsheet into your project:
composer require phpoffice/phpspreadsheet
If you are building your installation on a development machine that is on a different PHP version to the server where it will be deployed, or if your PHP CLI version is not the same as your run-time such as
php-fpm or Apache's
mod_php, then you might want to add the following to your
composer.json before installing:
and then run
to ensure that the correct dependencies are retrieved to match your deployment environment.
See CLI vs Application run-time for more details.
Additional Installation Options
If you want to write to PDF, or to include Charts when you write to HTML or PDF, then you will need to install additional libraries:
For PDF Generation, you can install any of the following, and then configure PhpSpreadsheet to indicate which library you are going to use:
and configure PhpSpreadsheet using:
// Dompdf, Mpdf or Tcpdf (as appropriate)
$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class;
or the appropriate PDF Writer wrapper for the library that you have chosen to install.
For Chart export, we support following packages, which you will also need to install yourself using
- jpgraph/jpgraph (this package was abandoned at version 4.0. You can manually download the latest version that supports PHP 8 and above from jpgraph.net)
- mitoteam/jpgraph (fork with php 8.1 support)
and then configure PhpSpreadsheet using:
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class); // to use jpgraph/jpgraph
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\MtJpGraphRenderer::class); // to use mitoteam/jpgraph
One or the other of these libraries is necessary if you want to generate HTML or PDF files that include charts.
PHPExcel vs PhpSpreadsheet ?
PhpSpreadsheet is the next version of PHPExcel. It breaks compatibility to dramatically improve the code base quality (namespaces, PSR compliance, use of latest PHP language features, etc.).
Because all efforts have shifted to PhpSpreadsheet, PHPExcel will no longer be maintained. All contributions for PHPExcel, patches and new features, should target PhpSpreadsheet
Do you need to migrate? There is an automated tool for that.
PhpSpreadsheet is licensed under MIT.
*Note that all licence references and agreements mentioned in the PhpSpreadsheet README section above are relevant to that project's source code only.