This article is about the process of eventually storing Excel data in a SQLite database.
In my case, because the database update, need to re-do a full database, for the manager, it is obvious that Excel is the best choice, but to my side, and can not directly use the Excel file, in view of the large amount of data in Excel file, the ape can not go to insert data to build the library, So there are all the following.
1. Convert the Excel file into a CSV file (comma-separated values)
After you get the CSV file, do not worry, avoid coding problems, it is best to open the CSV file in TXT format, and save it as a TXT file .
The original Excel file, the exported CSV file, and the last TXT file. OK, the basic data file is ready, and the Database Operations section begins below.
2. Use Mesasqlite to put TXT file contents into storage
Open Mesasqlite, we need to create a new database first
Named full amount, put on the desktop, click Save
We can see that there is a suffix named Rdb on the desktop, we can directly modify the prefix name is DB, also do not change.
Open to see the full picture:
New Table
Add a field to a table
Final table structure
The next step is the key:
We click Import on the menu bar, and select the table that you just built
Then select the TXT file that was placed on the desktop before the result
Then, a. Use the ' delimiter to display the field in a branch
B. Drag the right-hand field corresponding to the left field
C. Click the red dot to select it
D. Click Import
If there is no exception, the display successfully inserted XX bar data, the last display:
Complete.
Exit the database and use the terminal to open the database with SQLite3:
Using the Mesasqlite inbound CSV file