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.
<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.
you can try this library http://phpexcel.codeplex.com/
or you can create .csv file for example and then import them to excel.
if you just want/need to create a very simple table, you just need to make a *.csv-file which can be opened by excel - but not: you can't use formulas in this and you can't do any kind of formatting.
I wrote a simple library for exporting Excel-friendly XML files from PHP: http://github.com/elidickinson/php-export-data
You can try and create a CSV file, like this:
name;surname;blabla
name;surname;blabla
name;surname;blabla
name;surname;blabla
Excel should eat this :)
It is convenient to use PHP CVS functions: http://php.net/manual/en/function.fputcsv.php
to write you can use : Spreadsheet_Excel_Writer is a tool for creating Excel files without the need for COM components
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php but you cant appaend to file , only to create it.
or using phpexcel (support excel 2007)
http://phpexcel.codeplex.com/
and you can append see a example :
http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=82996