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
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.
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.
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.
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.
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.
Using import Button tool in the SQL result. See the image
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)
:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With