Re: Excel to CSV
| From: | tg-php at gryffyndevelopment dot com | Date: | Sat, 11 Mar 2006 13:53:23 +0000 |
| Subject: | Re: Excel to CSV | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-41452@lists.php.net to get a copy of this message | ||
The other response is half correct.. I havn't seen anything to read data from Excel with PHP
(although it's technically possible, just kind of complicated) so the easiest solution is to
use Excel and just have it load the file and save it in CSV format.
The part that's not entirely correct is the "PHP can't talk to Excel" part.
It's cumbersome, but PHP can use a COM connection to control Excel (or Word or MapPoint or
Access or Outlook..etc). This means you'd have to have Excel loaded on the server that was
running PHP, which may not be an option.
For an example of PHP + COM with Excel, check out:
http://www.php.net/manual/en/class.com.php
Look down the page for the entry posted by "flintjt at hotmail dot com"
If COM doesn't work for you and you don't mind getting your hands dirty, I believe you can
get the Excel file format spec.. maybe through the OpenOffice sources.. and figure out how to read
XLS files that way.
The Excel Object Model might help you with the proper properties/methods/etc:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrgrfexcelworkbookobject.asp
Good luck.
-TG
= = = Original message = = =
Dear All,
Have you any script/example how to Save As Excel file to CSV using PHP?
Thanks & Regards,
Anita
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.