Excel file import MySQL

Source: Internet
Author: User

In the process of data processing, the Excel file under Windows is often imported into MySQL under Linux. There are some problems with this.

1. First, build the table in MySQL. Commands are best available in Notepad and can be modified at any time and executed at any time

null,...);

2. Cut out what you need to import in Excel. Then use the Save As feature of Excel to save as TXT, regardless of whether the encoding is utf-8 or Unicode.

3. But neither Utf-8 nor Unicode,linux/mysql are recognizable and need to be converted into ASIIC. Here I use the notepad++. After opening the file point: Format, to ANSI encoding format. Then save and upload to the Linux machine

4. Note that there may be some cells in Excel that use a soft return (Alt+enter input). These returns are converted into text and will become a true carriage return. So you have to find a way to get rid of them. I used a lookup (input alt+10), but because there are some I need, There was something I didn't need, so I deleted the column I didn't need. The workload is relatively large.

5. You can then import the

' /home/a.txt ' Into TABLE mysql.tablename  '\ t'\ n';

Here, \ t represents a tab and is modified according to the file you generated.

Excel file import MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.