Importing data to mysql from excel file

Hi,

I have an excel file contains data. I want to import this data in Mysql database. Is there any tool or script can be used to do such thing? Put in mind the file contains utf8 data.

Thanks in advance
LVL 8
Ahmed MerghaniSoftware EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan CraciunIT ConsultantCommented:
I would first convert the Excel file to csv.
Since you will lose the accented characters if you save as csv directly, you can save the file as Unicode (.txt).
Then simply replace TAB characters with ;, or tell phpmyadmin, MySQL Workbench etc that the delimiter is the tab character.

HTH,
Dan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ahmed MerghaniSoftware EngineerAuthor Commented:
Thanks for your response. I need some more clarifications. How to save .txt as .csv?? How to tell phpmyadmin, the delimiter is tab??
0
Dan CraciunIT ConsultantCommented:
The csv is a text file, formatted. You can simply change the extension of the .txt to .csv. Only it won't be "Comma Separated Values", it will be "Tab Separated Values".

Then, in phpmyadmin use "\t" as delimiter.

import with phpMyAdmin
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Ahmed MerghaniSoftware EngineerAuthor Commented:
Thanks for your response.

It gives me this error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`' at line 1
0
Dan CraciunIT ConsultantCommented:
Did you select CSV as the format on import? That looks like the kind of error you would get when importing an SQL file.
0
Ahmed MerghaniSoftware EngineerAuthor Commented:
Yes I did. Attached part of the CSV file
123.csv
0
Dan CraciunIT ConsultantCommented:
Works here. But I had to change the encoding to UTF8, because it was UCS2.

I created the table first, then imported the data.
import successful
0
Ahmed MerghaniSoftware EngineerAuthor Commented:
Ok that was the problem and now it works. I did not realize that encoding is not utf8!! I changed the encoding to utf8 and then I import the file without creating the table and it works.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.