Practical phpxlsx

Format transformations


phpxlsx includes the conversion plugin to transform spreadsheet formats: XLSX to PDF, XLS to XLSX, ODS to XLSX... Two conversion plugins are available: libreoffice and msexcel.

CSV files can be imported as XLSX contents using addCsv. This method uses PHP native classes.


Converting XLSX to PDF is as simple as choosing the conversion plugin method to use and then invoking transform:

You can transform documents created from scratch with phpxlsx, or generated with any other application, like MS Word, LibreOffice or another external library or program.

XLS and ODS can also be transformed. Thus, it is possible to convert XLS files to XLSX to work with the set of methods of the phpxlsx API, and then transform them again to XLS or to PDF:

The conversion plugin page has all the information regarding this functionality.

Import CSV

CSV files are text files commonly used to show data in a table format. phpxlsx allows to import content from these files and add them as a table in an XLSX:

If the CSV content includes a first row that works as a table header, the firstRowAsHeader allows to set it as such, applying additional styles with headerCellStyles and headerTextStyles options:

Next - Protect, encrypt and sign