Windows command line import Excel data into SQLite database

Source: Internet
Author: User

1. Convert file format to prevent Chinese garbled: Save excel in CSV (comma delimited) (*.csv) format, close the file, open the. CSV file that you just saved with Notepad, and then save as UTF-8 Rich text. It is important to note that, after such a conversion, the numbers are all translated into text.


2, through the ADB shell (adb.exe stored in the Android Development Software installation folder, such as F:\Develope\Tools\adt-bundle-windows-x86\sdk\ Platform-tools\) Change the use rights of the SQLite database. Open the AVD virtual appliance before running ADB. Run under command line: F:\DEVELOPE\TOOLS\ADT-BUNDLE-WINDOWS-X86\SDK\PLATFORM-TOOLS>ADB Shell-- run adb shell [Email protected]:/# cd/data/data/com.example.dgtaxt/ --Enter your project's folder [Email protected]:/ #chmod 777 databases to change Databases folder permissions to all users  3, confirm that the database has a corresponding table, if not to create first. You can use the Sqlite3 command to create a table in the ADB shell. such as: [Email protected]:/data/data/com.example.dgtaxt/databases # sqlite3 dgtaxt.db ---Open the desired database dgtaxt.db sqlite>create TABLE dgtaxt201311 (_id NVARCHAR) PRIMARY KEY, name NVARCHAR, Complay nvarch   AR (100)); -- means to create a table dgtaxt201311.  4 . Use the ADB push command to copy the files on your hard disk to the Databases folder of an application in Android AVD. such as: f:\develope\tools\adt-bundle-windows-x86\sdk\platform-tools> adbpush F:\Develope\\Java\ Test\utf8.csv data/data/com.example.dgtaxt/databases-- put the utf8.csv file into the Databases folder  5. Import data to SQLite database. such as:f:\develope\tools\adt-bundle-windows-x86\sdk\platform-tools>adb Shell--Restart the shell[Email protected]:/# CD data/data/com.example.dgtaxt/databases[Email protected]:/data/data/com.example.dgtaxt/databases # sqlite3 dgtaxt.dbsqlite>. Separator ', '--comma delimitersqlite>. Import utf8.csv dgtaxt201311- fromutf8.csv importing data into table dgtaxt201311Complete.
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.