Build SQLite Database from Numbers Table

Here’s an example of how to create an SQLite database using the contents of a basic Numbers table:

presidents-table

NOTE: The example script assumes that the source table has a single row header whose cell values will be used as the names of the created record fields in the database. Before running the script, make sure that the value of each cell of the row header is unique.

NOTE: By default, the Database Events application creates database file in a folder titled “Databases” located in the Documents folder. The provided script will create this folder if it doesn’t exist.

DO THIS ► DOWNLOAD a Numbers document containing the example table.

The result of a successful execution of the script will be a new SQLite database file with a file extension of “.dbev” and two supporting files with extended versions of the database file extension  (⬇ see below ) 

databases
Querying the Database

SQLite database queries using the Database Events application are written using standard AppleScript statements incorporating “whose” and “where” clauses to locate records by the value of their fields. The example script below demonstrates this technique using the created example database.

When referencing the database in query scripts, use a POSIX path reference to the main database file (the one with the file extension of “.dbev”)

president-dialog

TOP | CONTINUE