Import data from Execl to Sqlite3

Source: Internet
Author: User
Obtain the CVS file: select the Execl file menu and select the saveas option. In the save file dialog box that appears, select TextCVS (. cvs) file type. Select the EditFiltersettings option and press the save button. A dialog box is displayed. You can set the format of the file to be saved and select the font (Unicode,

Obtain the CVS file: select the Execl file menu and select save as. In the save file dialog box that appears, select Text CVS (. cvs) file type, check the Edit Filter settings option, and press the save button. A dialog box is displayed. You can set the format of the file to be saved and select the font (Unicode,

Obtain the CVS file: select the Execl file menu and select the save as option. In the save file dialog box that appears, select the Text CVS (. cvs) file type from the save file type,

Select the Edit Filter settings option and click save. A dialog box is displayed, which allows you to set the format of the file to be saved,

Select the font (Unicode, Weatern Europe, etc.) by yourself. You can select ',' (comma), or ';' (semicolon) if you want

Execl source file does not contain this symbol, other options to select the desired format, and then click 'OK' into [this article from the Internet (http://www.68idc.cn)] row save, you can get a suffix

Cvs file, which is a text file and can be opened in a text editor (TxtEditor.

Import the CVS file to the sqlite3 database:

The content in the cvs file is as follows:

Yield, generate
Yoke, yoke
Yonder, over there
You, you; you
Young, young
Youngster, Junior
Your, yours
Yourself, yourself
Youth, youth
Youthful, young
Zeal, enthusiastic
Zealous, enthusiastic
Zero, zero
Zest, enthusiastic
Zinc, zinc
Zone
Zoo, zoo
Zoological, Animal Science
Zoology, Animal Science

Go to the sqlite3 database and enter:

Sqlite3 dict. db

Dict. db is a database. If the database does not exist, it will be created. If the database already exists, it will enter the database

First, create a table in sqlite3. The format of the created table must comply with the format of the CVS file content (mainly the columns must be consistent). The command is as follows:

Create table word (word varchar (20), desc varchar (100 ));

Next, import CVS to the word Table. Set the separator to ',' (comma) and enter the following command:

. Separator ','

Run the following command:

. Import *. cvs word

You can import the content in cvs to the word table.

Note: Both separator and import have a small point, which is different from SQL in sqlite,

The two statements do not end with a semicolon ,*. Cvs is the file name of CVS, and word is the table name.

To check whether the import is successful, enter the following command:

Select * from word;

Result:

Yield | generate
Yoke | yoke
Yonder | over there
You | you; you
Young | young
Youngster | teenager
Your | your
Yourself | yourself
Youth | youth
Youthful | young
Zeal | enthusiastic
Zealous | enthusiastic
Zero | zero
Zest | enthusiastic
Zinc | zinc
Zone | zone
Zoo | zoo
Zoological | Animal Science
Zoology | Animal Science

The data is imported successfully.

Sometimes a large amount of data needs to be imported into the database. The above method is time-saving and labor-saving.

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.