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
https://forums.phpfreaks.com/topic/116223-solved-excel-to-mysql/
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.

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.