Link to home
Start Free TrialLog in
Avatar of Ahmed Merghani
Ahmed MerghaniFlag for Sudan

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ahmed Merghani

ASKER

Thanks for your response. I need some more clarifications. How to save .txt as .csv?? How to tell phpmyadmin, the delimiter is tab??
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.

User generated image
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
Did you select CSV as the format on import? That looks like the kind of error you would get when importing an SQL file.
Yes I did. Attached part of the CSV file
123.csv
Works here. But I had to change the encoding to UTF8, because it was UCS2.

I created the table first, then imported the data.
User generated image
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.