Skip to content

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
Step-by-step guide: how to use PhpSpreadsheetInstall, first run, examples, tips and FAQs

How to get it

  1. 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. 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. 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

ProjectStarsTypeLevelUpdatedBest for
PhpSpreadsheet (this)14kLibraryintermediate4 days agoPHP developers who need to generate or import spreadsheet files from a web app or script
Luckysheet16.6kLibraryintermediate1.2 years agoDevelopers maintaining an existing site that already embeds Luckysheet
Laravel-Excel12.7kLibraryintermediate14 days agoLaravel developers who need to export database query results to Excel or CSV
x-spreadsheet14.6kLibraryintermediate2.2 years agoWeb developers who want a spreadsheet-style editor inside their own app
symfony31.2kLibraryintermediate4 days agoPHP developers building web applications that need a structured framework
guzzle23.4kLibraryintermediate11 days agoPHP 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.