cms9651 — 2011-02-15T04:11:38-05:00 — #1
Import .xls file into a mysql database
I have a .xls file that i would like to import into a mysql database, I am ok creating the mysql table _temp in my webspace and try this code in mysql:
LOAD DATA INFILE
INTO TABLE _temp
FIELDS TERMINATED BY ',' IGNORE 1 LINES;
[Err] 1261 - Row 1 doesn't contain data for all columns
Any ideas most welcome.
guido2004 — 2011-02-15T04:44:00-05:00 — #2
Your temp table contains more columns than row 1 of the xls file.
cms9651 — 2011-02-15T05:39:22-05:00 — #3
Thanks Guido... you are right...
LOAD DATA INFILE 'D:/11_02_11.xls'
REPLACE INTO TABLE _temp
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '\\"'
LINES TERMINATED BY '\\r\
' IGNORE 1 LINES ;
The fields are in the same order in the DB as they are in the .xls