Kane250 Posted July 23, 2008 Share Posted July 23, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/116223-solved-excel-to-mysql/ Share on other sites More sharing options...
mbeals Posted July 23, 2008 Share Posted July 23, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/116223-solved-excel-to-mysql/#findComment-597790 Share on other sites More sharing options...
accident Posted July 23, 2008 Share Posted July 23, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/116223-solved-excel-to-mysql/#findComment-597800 Share on other sites More sharing options...
Kane250 Posted July 23, 2008 Author Share Posted July 23, 2008 Oh that seems so easy! Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/116223-solved-excel-to-mysql/#findComment-597853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.