RE: [PHP] import XLS sheet into DB
Try using: http://sourceforge.net/docman/display_doc.php?docid=22092&group_id=99160 I have never used it, but it looks very straightforward. Docs are here: http://sourceforge.net/docman/display_doc.php?docid=22092&group_id=99160 code should be something like this: (for mysql, based on docs) read("filename.xls"); $data = $xl_reader->sheets[0]['cells']; Foreach($cells as $c){ foreach($c as $cd) $row[] = "\"".$cd."\""; $row = implode(",", $row); mysql_query("insert into `table` values(".$row.")"); } ?> -Original Message- From: Jason Pruim [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2008 12:29 PM To: Alain R. Cc: php-general@lists.php.net Subject: Re: [PHP] import XLS sheet into DB On Aug 15, 2008, at 4:29 AM, Alain R. wrote: > Hi, > > I would like to import content of an XLS sheet into a PostgreSQL DB > (table). > > How can i do that ? > thanks a lot, > > A. Alain, I haven't done it with PostgreSQL... But assuming it's not far from MySQL just save the excel file as a csv, or a tab separated file and import that. If you find away to import a strict xls file let me know, I have a project that could really benefit from that :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.3/1612 - Release Date: 14/08/2008 18:03 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] import XLS sheet into DB
> -Original Message- > From: Alain R. [mailto:[EMAIL PROTECTED] > Sent: Friday, August 15, 2008 3:30 AM > To: php-general@lists.php.net > Subject: [PHP] import XLS sheet into DB > > Hi, > > I would like to import content of an XLS sheet into a PostgreSQL DB > (table). > > How can i do that ? > thanks a lot, I fail to see how this has anything to do with PHP. Regardless, I think you could just import it as a text field if you're wanting to save the entire sheet. I'm not sure that I understand the scope of your question. Do you want the elements separated into table columns, or do you just want to store the XLS for later retrieval as a whole? Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] import XLS sheet into DB
On Aug 15, 2008, at 4:29 AM, Alain R. wrote: Hi, I would like to import content of an XLS sheet into a PostgreSQL DB (table). How can i do that ? thanks a lot, A. Alain, I haven't done it with PostgreSQL... But assuming it's not far from MySQL just save the excel file as a csv, or a tab separated file and import that. If you find away to import a strict xls file let me know, I have a project that could really benefit from that :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] import XLS sheet into DB
On Fri, Aug 15, 2008 at 10:29:40AM +0200, Alain R. wrote: > Hi, > > I would like to import content of an XLS sheet into a PostgreSQL DB (table). > > How can i do that ? Your question is not php related ;-) Maybe, export the sheet as comma separated csv file and import it to postgresql. Happy coding Mario -- -BEGIN GEEK CODE BLOCK- Version: 3.12 GCS/CM d- s++: a+ C>$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M- V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D G++ e* h r+++ y --END GEEK CODE BLOCK-- signature.asc Description: Digital signature
[PHP] import XLS sheet into DB
Hi, I would like to import content of an XLS sheet into a PostgreSQL DB (table). How can i do that ? thanks a lot, A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php