Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql table import wizard fails to import a csv file

I am trying to import a csv file (Window 10), created by notepad++, using semicolons as delimiters, extension .csv.

I use Mysql Workbench 6.3, import wizard. Encode in notepad++ is UTF-8, and the mysql table I am trying to load is utf-8 default collation

Import wizard fails to import and shows two messages: Table data Import: Can't analyze the file, please try to change encoding type. If that doesn't help, maybe the file is no: csv, or the file is empty

Unhandled exception: 'ascii' codec can't encode character u'\xfa' in position 1: ordinal not in range (128)

How can I do to trace this error. I tried several encodings for the file, but the error persists.

thanks

like image 954
user1907514 Avatar asked Dec 19 '15 10:12

user1907514


People also ask

How to import CSV file into mysql table?

This tutorial shows you how to use the LOAD DATA INFILE statement to import CSV file into MySQL table. The LOAD DATA INFILE statement allows you to read data from a text file and import the file’s data into a database table very fast.

How do I import data from a CSV file in Excel?

After selecting the file, it will provide two options, to import the data in an existing table or create a new one. If selecting an existing table, then select one of the tables where you want to import the data. For importing csv into a new table, mention the name of the table.

How do I import data into a table?

The following are steps that you want to import data into a table: Open table to which the data is loaded. Click Import button, choose a CSV file and click Open button Review the data, click Apply button.

How do I export and import data in MySQL Workbench?

For an overview of the data export and import options in MySQL Workbench, see Section 6.5, “Data Export and Import”. The wizard is accessible from the object browser's context menu by right-clicking on a table and choose either Table Data Export Wizard or Table Data Import Wizard, as the next figure shows.


4 Answers

There are 3 csv

While you are saving the excel data using "Save as" option select msdos .csv format. Note that there are 3 csv format out of it select only MS-DOS .csv as highlighted in image.

like image 97
Dinesh Ravi Avatar answered Oct 12 '22 21:10

Dinesh Ravi


Using import Button tool in the SQL result. See the image

Sử dụng công cụ import trên cửa sổ câu lệnh SQL.

like image 20
Biết Tuốt Avatar answered Oct 12 '22 22:10

Biết Tuốt


I tried every CSV format there was with no luck. In the end I found that selecting this option worked with a file saved as CSV (MS-DOS) (*.csv):

enter image description here

like image 3
Jossy Avatar answered Oct 12 '22 21:10

Jossy


I found this solution and it works for me

The problem is UTF-8 encoding

In excel sometimes it usually fails when saving, what can be used is Google Drive.

1.- Create a Drive Spreadsheet

2.- Import your .csv document

3.- Go to File-> Download as-> csv

And that's it, it should work because it was encoded back to utf-8.

like image 1
Setink Avatar answered Oct 12 '22 21:10

Setink