Jump to content

[SOLVED] Create Excel File


sseeley

Recommended Posts

Getting data from an SQL table is fairly easy,but you must first tell me how is yuor SQL table is arranged.

 

For the excel sheet, it is not that easy, the only current PHP excel sheet writer and reader that I know of and that I have not tested yet is at:

 

http://pear.php.net/package/Spreadsheet_Excel_Writer

 

I recommend downloading it and try to make it to your desires.

Link to comment
Share on other sites

You don't need to create an actual .xls file in order to have a "downloadble Excel sheet." If you output the correct Content-Type: header followed by tabular data, excel can probably handle it - http://www.the-art-of-web.com/php/dataexport/

 

Do you have an example of what you are trying publish?

The latest version of Excel will warn users before opening the file though.  Fine for a free site maybe, but not in a business environment.

I've used each of the following to create Excel files and they work great:

http://pear.php.net/package/Spreadsheet_Excel_Writer

http://www.codeplex.com/PHPExcel

 

Link to comment
Share on other sites

I'd recommend PHPExcel (thanks roopurt18) if you want to create a real Excel file rather than a CSV file. A real Excel file has a number of benefits, including formatting cells and values, and the inclusion of images, which you can't do with a CSV file.

Despite the complexities of the Excel file format, using any of the libraries mentioned in this thread makes it very easy to write Excel files from within PHP, because they hide all the complexities; and most are well documented

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.