How can i write data into an excel using PHP

zod picture zod · Oct 19, 2010 · Viewed 68.7k times · Source

Is it possible to append content to an .xls file using PHP fwrite()?

When i try this using fwrite(), the resulting file causes an error message in Excel 2007.

Is there a specific separator I can use to accomplish this?

Is it possible without a third party library?

Answer

Mark Baker picture Mark Baker · Oct 19, 2010

You can use the PhpSpreadsheet library, to read an existing Excel file, add new rows/columns to it, then write it back as a real Excel file.

Disclaimer: I am one of the authors of this library.