Importing Data to sql database from excel

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dave.hawksworth
Forum Newbie
Posts: 11
Joined: Thu Feb 18, 2010 8:45 am

Importing Data to sql database from excel

Post by dave.hawksworth »

I have an sql database with a date field and I want to populate it with a large ammount of records from an excel spreadsheet.
Using phpMyadmin the only way I have found to import the data from the spreadsheet is by converting it to a csv file and then importing.
Unfortunately this method imports all the text fields correctly but the date field is imported as a series of zero's in the date format.
Does anyone know a way round this?
Thanks
Dave
Kurby
Forum Commoner
Posts: 63
Joined: Tue Feb 23, 2010 10:51 am

Re: Importing Data to sql database from excel

Post by Kurby »

Your date field may be in the wrong format. Can you give an example of your CSV and table format?
dave.hawksworth
Forum Newbie
Posts: 11
Joined: Thu Feb 18, 2010 8:45 am

Re: Importing Data to sql database from excel

Post by dave.hawksworth »

Thanks you were right although I thought I had checked several times The xl sheet was dd-Jan-yyyy, and the db table was yyyy-mm-dd. A bit sloppy on my part.
Dave :D
rd.dcse
Forum Newbie
Posts: 7
Joined: Fri Jun 11, 2010 2:56 pm

Re: Importing Data to sql database from excel

Post by rd.dcse »

Please send me the code for importing file to mysql i will be thankfull to you rd.dcse@gmail.com

Thanks in advance
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: Importing Data to sql database from excel

Post by internet-solution »

rd.dcse wrote:Please send me the code for importing file to mysql i will be thankfull to you rd.dcse@gmail.com

Thanks in advance
OP is using PhpMyAdmin import for importing CSV file into MySQL.
Post Reply