Jump to content

[SOLVED] Excel to MySQL


Kane250

Recommended Posts

I'm sure this is something that is common for most but new for me.

 

Can someone point me in the direction for instructions of how to import data from an excel spreadsheet to my MySQ database? This is basically a list of e-mail addresses, and I don't know how to format the excel spreadsheet for this or how to add it to my database. My table is set up like this: email, lastname, firstname, emailID where emailID is my primary key.

 

Any help would be greatly appreciated that could get me started on doing this.

 

Thanks!

Link to comment
Share on other sites

easiest way to to do it is to install phpmyadmin.  It has the option to import a CSV file.  So just format your excel doc so that the columns match the database, save as a CSV, then import into phpmyadmin.

 

without phpmyadmin, I'd just write a script to read in the CSV file line by line and generate an Insert statement for each.

Link to comment
Share on other sites

yes as mbeals said, use php my admin, it is really easy.

You would format your excel document to be in columns the following way

 

email, lastname, firstname, blank

 

The fourth column leave it blank

Now save the excel document as a CSV file.

in phpmyadmin go to import, click on CSV using LOAD DATA

Then set the correct values for the fields, so Fields terminated by would probably be a comma ,

Fields enclosed should either be double quotes or empty depending on how excel saved the file.

 

and then it should import fine.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.