excel_to_sqlite Function
Syntax
dim result as L = excel_to_sqlite(c excelfilename, c sqlitefilename)
Arguments
- excelfilenameCharacter
Filename of the Excel file.
- sqlitefilenameCharacter
Filename of the SQLite database to create.
Returns
- resultLogical
Returns .t. if the SQLite database was created. Otherwise, returns .f..
Description
Creates a SQLite database file from data in an Excel file.
Discussion
The excel_to_sqlite() function creates a SQLite database file from an Excel file. Each sheet in the Excel file is a table. If the first column in each sheet is numeric data and there are no duplicate values in the column data, that column is configured as the Primary Key for the table in the SQLite database unless the Primary Key is explicitly set by adding '(Primary key)' after the column name in the first row of the Excel sheet. With v4.6.4.7, you can now explicitly designate the primary key by including the keyword (Primary key) after the column name in the Excel sheet. You can now also designate that a column should be indexed by including the keyword (Index) after the column name in Excel sheet. Prior to v4.6.4.7, it was not possible to designate that a column should be indexed and therefor the primary key was automatically assigned.
Example
dim filename as c = "C:\temp\customers.xslx"
dim sqliteDbName as c = "customers.db"
if (excel_to_sqlite(filename, sqliteDbName)) then
' Success
else
' Could not create SQLite Database
end if