Link to home
Start Free TrialLog in
Avatar of martyje
martyje

asked on

How do I import data from Excel Spreadsheet into Mysql?

How do I import data from Excel Spreadsheet into Mysql?
I have a speardshee that I am trying to import into Mysql. How do I do that?

thanks.
ASKER CERTIFIED SOLUTION
Avatar of mredfelix
mredfelix

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I often do this by creating a new formula column in excel that creates INSERT statements for each line, then copying that formula down to each row.

A             B                C              D
Steve      Johnson     3323        ='INSERT INTO Employee(Firstname,Lastname,EmployeeNumber) VALUES('"&A2&"','"&B2&"','"&C2&"')'
So, then I take the results of the formula in that column, and paste it into Query Analyzer or whatever, and execute it.
Avatar of martyje
martyje

ASKER

I have no clue what u guys are talking about. Sorry. I am using phpMyadmin, should have stated that but anyway, is there any simple way to import excel file inot mysql through phpmyadmin?
Avatar of martyje

ASKER

mredfelix:
I am getting an error "Can't find file 'test.csv' "
test.csv file is the file that I am trying to import. Myslq is residing on a different sever is that a problem?
Avatar of martyje

ASKER

Thanks much, I just had to give the 'exact' path of the file, it worked perfectly.
Avatar of martyje

ASKER

Just an FYI, this is how the exact code that worked...

load data local infile 'c:\\wamp\\www\\test.csv' into table keywords
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(keyword, date_searched)