PhpSpreadsheet lets PHP applications read and write spreadsheet files in Excel, LibreOffice Calc, and many other formats through a set of classes.
Overview
PhpSpreadsheet is a library written in pure PHP that provides classes for working with spreadsheet documents. Teams use it to load, manipulate, and save workbook data without requiring a desktop office suite on the server.
It supports reading and writing multiple formats, including Office Open XML (xlsx), BIFF Excel (xls), Open Document (ods), CSV, HTML, SYLK, SpreadsheetML, and Gnumeric. PDF export is available when you install and configure a separate PDF library such as Dompdf, mPDF, or TCPDF.
Install it into a PHP project with Composer. Optional chart rendering for HTML or PDF output requires additional packages such as jpgraph. The project succeeded PHPExcel and is maintained for security and bug fixes on the active branch.
Documentation covers architecture, worksheets, cell access, and file I/O, with samples that can be run from the command line or via PHP’s built-in web server for learning.
Key features
- Read and write xlsx, xls, and ods
- CSV and HTML import and export
- Worksheet and cell manipulation
- Optional PDF writers
- Optional chart rendering
- Composer-based installation
- Successor to PHPExcel
Use cases
- Generate Excel reports from PHP apps
- Import uploaded spreadsheets
- Convert between spreadsheet formats
- Automate workbook creation in batch jobs