Page 1 of 1

Writing to an excel sheet using PHP

Posted: Tue May 12, 2009 10:21 am
by nanditagokhale
Hello everybody,
I am trying to write to an excel sheet using PHP..here's the code

Code: Select all

 
$filename ="Report.xls";
$export_file = "/home/expressi/public_html/store/admin/".$filename;
$fp=fopen($export_file,"wb");
fwrite($fp,"Productid\t");
fwrite($fp,"Product Code\t");
fwrite($fp,"Number of units in inventory\t");
fwrite($fp,"Number of units sold\t");
 
Here am using \n for new line and \t to write to a new tab

Now if I want to to access a particular row and col, how can I do that?
Or can u suggest any other convenient method of writing to excel sheet.

I am coding in Xcart software. So the basic code is in place and I am customizing it.

Re: Writing to an excel sheet using PHP

Posted: Tue May 12, 2009 12:26 pm
by Mark Baker
nanditagokhale wrote:I am trying to write to an excel sheet using PHP..here's the code
Now if I want to to access a particular row and col, how can I do that?
Or can u suggest any other convenient method of writing to excel sheet.
There is always the option of using a library such as PHPExcel to write a real Excel workbook rather than simply writing text to a file that has an extension of .xls