XLS to MYSQL

Status
Not open for further replies.

abednego

New member
Jan 31, 2007
123
0
0
Hello,

I was wondering what the best way of converting data in a .xls file and inserting it into a MYSQL database would be. Thanks for your help.
 


Another way would be to export the list as a CSV (Comma Separated Value) file and then use PHP to parse that.

If anyone's interested I've got a class someplace that does something similar.
 
If you export it to a CSV file, you can just import it directly into mysql using the native Mysql client.

Code:
[FONT=courier,monospace]LOAD DATA [B]LOCAL[/B] INFILE '[I]yourfile.csv[/I]' 
INTO TABLE [I]your_table[/I] 
FIELDS TERMINATED BY ',' 
LINES TERMINATED BY '\n' 
(field1, field2, field3);[/FONT]
 
Also, if you have PHPMyAdmin for your MySQL server, you can import it direct.
 
Status
Not open for further replies.