Jump to content

Archived

This topic is now archived and is closed to further replies.

ober

Excel w/ PHP

Recommended Posts

I've looked through the manual and on other places on the web including searching these forums. The only thing I've found about Excel is how to open a file and push it to the user via a header call.

Is there a way to create a new document... and to just save that document to a folder so I can provide a link to it where they can do a "right-click->save as..." type of deal?

Any help would be appreciated.

Share this post


Link to post
Share on other sites
Not sure if this is helpful enough, but I have a working application where data are abstracted from a MySQL database and a CSV file is written (with column headings) that can be downloaded and imports into Excel.

No fancy formatting, no formulae, no macros - just the plain data.

Share this post


Link to post
Share on other sites
are you looking for something like this?

[a href=\"http://www.sitepoint.com/article/pear-spreadsheet_excel_writer\" target=\"_blank\"]http://www.sitepoint.com/article/pear-spre...et_excel_writer[/a]

Share this post


Link to post
Share on other sites
I have a script which will extract data from mySQL database, and then by simply using a basic table layout, and then saving the HTML output into a file with a .xls extension, the resulting database data is stored as a microsoft excel document.

Share this post


Link to post
Share on other sites
here's another linkie:

[a href=\"http://www.tutorialized.com/tutorial/Create-excel-files-with-php/11042\" target=\"_blank\"]http://www.tutorialized.com/tutorial/Creat...-with-php/11042[/a]

Share this post


Link to post
Share on other sites
Alright... thanks for the replies all. Just to answer a few of the questions:

1) I'm not looking for a CSV format. I already create that for one of my apps and that works fine.

2) I'm also not looking for an export from an HTML table to Excel.

I'm looking to create a new document, play with it, format it, do whatever I'd do manually with Excel, and do it all with PHP and possibly Pear.

Thanks for the links CV... I'll check those out ;)

Share this post


Link to post
Share on other sites
I did something like this long time ago, but I am not sure how flexiable it can be. Excel support .slk files. These files are text so you can write them in php no problem. Usually there is a head with the document format, then the rows with their data (like C;X4;K"test" or C;Y7;K6;ESUM(R[-3]C:R[-1]C) )

The easiest way to make it is to create the form in excel and save it as .slk once you get this, you can play with it to create you file.

Share this post


Link to post
Share on other sites
hmmmm...

Is this any help?

[a href=\"http://www.sitepoint.com/article/pear-spreadsheet_excel_writer\" target=\"_blank\"]http://www.sitepoint.com/article/pear-spre...et_excel_writer[/a]

Lite...
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
For example, if we wanted to save the same spreadsheet we created in our first example to a file named 'test.xls', we would do it like so:

Example 2:

addWorksheet('test worksheet');

$worksheet->write(0, 0, 'Name');
$worksheet->write(0, 1, 'Age');
$worksheet->write(1, 0, 'John Smith');
$worksheet->write(1, 1, 10);

// We still need to explicitly close the workbook
$workbook->close();
?>[/quote]

from [a href=\"http://blinduser.blogspot.com/2006/03/excel-and-php-without-com.html\" target=\"_blank\"]http://blinduser.blogspot.com/2006/03/exce...ithout-com.html[/a]

Share this post


Link to post
Share on other sites

×

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.