
PhpSpreadsheet
A pure PHP library for reading and writing Excel, LibreOffice Calc and other spreadsheet files.
- Stars
- 14k
- Forks
- 3.6k
- Licence
- MIT
- Language
- PHP
- Last update
- 4 days ago
- Type
- Library
What it is
PhpSpreadsheet is a PHP code library that lets a program read and write spreadsheet files such as Excel and LibreOffice Calc documents. It is written in pure PHP, so it does not need Excel or other office software installed on the server. It is the successor to PHPExcel, which is no longer maintained.
- Generate an Excel report from database records in a PHP web application
- Read rows from an uploaded XLSX or ODS file and import them into a database
- Convert between spreadsheet formats such as XLS, XLSX and ODS
- Migrate existing PHPExcel code using the automated migration tool linked in the README
Great for
- PHP developers who need to generate or import spreadsheet files from a web app or script
- Teams migrating older code from PHPExcel
- Backend projects that produce reports or exports in Excel format
Not ideal for
- People who just want to edit a spreadsheet by hand; a desktop office program is a better fit
- Non-PHP projects, since the library only runs in PHP
- Projects on PHP versions below 8.2, which the README says is the current minimum
How to get it
- 1
Install with a package manager
You'll need: PHP 8.2 or newer · Composer
Install via Composer (see README docs link; exact command not shown in README)
git clone https://github.com/PHPOffice/PhpSpreadsheet - 2
Run it
- Install the library following the official installation docs at phpspreadsheet.readthedocs.io
- Create a new spreadsheet object in your PHP script
- Write cell values to the sheet
- Save the file in the format you need, such as XLSX
- 3
Get the most out of it
- Use the official documentation at phpspreadsheet.readthedocs.io for detailed usage guides
- Use the API documentation linked in the README to look up classes and methods
- Use the migration tool linked in the README if moving from PHPExcel
- Follow the author's Patreon articles on dates, formulas and number formats for advanced topics
Downloads
Strengths
- Pure PHP, so no external office software is required on the server
- Supports many formats, including Excel and LibreOffice Calc files
- Long-running project with 14,000+ GitHub stars and an MIT license
Trade-offs
- Requires PHP 8.2 as the minimum version according to the README
- Behaviour for advanced features such as charts and formulas is documented on an external site rather than in the README
- Large files may be memory-heavy; the README does not address this, so treat it as unverified
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| PhpSpreadsheet (this) | 14k | Library | intermediate | 4 days ago | PHP developers who need to generate or import spreadsheet files from a web app or script |
| Luckysheet | 16.6k | Library | intermediate | 1.2 years ago | Developers maintaining an existing site that already embeds Luckysheet |
| Laravel-Excel | 12.7k | Library | intermediate | 14 days ago | Laravel developers who need to export database query results to Excel or CSV |
| x-spreadsheet | 14.6k | Library | intermediate | 2.2 years ago | Web developers who want a spreadsheet-style editor inside their own app |
| symfony | 31.2k | Library | intermediate | 4 days ago | PHP developers building web applications that need a structured framework |
| guzzle | 23.4k | Library | intermediate | 11 days ago | PHP developers who need to call external REST or web service APIs |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.