Page 1 of 1

Export to excel in php

Posted: Fri May 29, 2009 6:39 am
by rabeehkm
Hi Experts,

i want to develop a page in which, when i click Export, an excel should open up.

I created a application, and i am able to open a Excel sheet when i click Export.

In the Excel First row contain headings(Name, Address, City)

I want the City to be a dropdown. I have googling for last 2 days, till i didnt find a solution.

The city should be a dropdown, listing cities in the database.

Can any one help me????

Thanks In Advance,
Rabeeh

Re: Export to excel in php

Posted: Fri May 29, 2009 4:22 pm
by califdon
PHP supports exporting a CSV file using a header that indicates that the associated application should be Microsoft Excel, but I don't know of any way to enable any special features of Excel, like dropdown lists. You can do that as HTML, but as far as I know, not in a CSV file, which is basically just a text file.

Re: Export to excel in php

Posted: Fri May 29, 2009 9:42 pm
by mikemike
You may have more luck with the COM library (this is only available on a Windows server - possibly through Wine, I've never tried). The COM library let's you create Microsoft Office documents dynamically, including (but not exclusively) Excel documents.

As for creating your drop-down boxes I'm not sure, you'll have to read the COM documentation. Creating a CSV would be your easiest option but you're limited to text-only.

Re: Export to excel in php

Posted: Tue Jun 02, 2009 12:28 pm
by Mark Baker
Take a look at a library such as PHPExcel which allows you to create genuine Excel workbooks (rather than simple CSV files) that support the Excel autofilter feature

Re: Export to excel in php

Posted: Tue Jun 02, 2009 6:41 pm
by Benjamin
:arrow: Moved to PHP - Code