Forum Moderators: coopster & phranque

Message Too Old, No Replies

help importing excel file into mySQL

         

gordygreenawalt

12:24 am on Nov 19, 2002 (gmt 0)

10+ Year Member



Hi everybody,

I REALLY need some help, I'm pulling my hair out over this. Okay, I had someone write some code that takes users information from the website and puts it into a database. I am using "phpmyadmin" to look at the database. So the database is already set up. Now I have all this info of about 9,000 people in an Excel file. It includes ALL of their contact info, etc. I need to import this into the database. This database is used to store info on "street team" members.

I am looking for someone to help me on this.

Thanks,

Gordy

[edited by: jatar_k at 12:39 am (utc) on Nov. 19, 2002]
[edit reason] email addresses are in profiles [/edit]

jatar_k

12:48 am on Nov 19, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] gordygreenawalt

I would suggest creating a db that has all of the same fields as the excel file, you may have to add some type of primary key though if there isn't one in the excel file.

It looks like you have already done this but just wnated to be sure. Then save the excel file as a .csv.

You can then look at this mysql command LOAD DATA INFILE [mysql.com].

You can then run the load data query through the window that says "Run SQL query/queries on database" after you click on the db name in phpmyadmin.

gordygreenawalt

2:21 am on Nov 19, 2002 (gmt 0)

10+ Year Member



Thanks for the quick reply. I already have the DB set up with about 3 entries. The data in the Excel file does not have a username, pass, date, ip, etc.. can I simply add the fields? I just have this feeling that it's not going to work out well when I do this. Also, there are many duplicate entries. If I set everyone's password to "pass" so they can log in and change their info.

Thanks for all the help.

Gordy

jatar_k

3:00 am on Nov 19, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well, I wouldn't worry about the duplicates for now.

You could always add blank columns for the extra fields that aren't in the excel file. I wouldn't worry too much about screwing it up, you can always delete all of the rows and tweak it and then do it again.

Another thought is you could script the whole transfer process, upload the csv, remove duplicates and then insert as well but this would take a little more time.