4.5. Create a SQLite database from Google Sheets

sqlitebiter gs is a subcommand to convert Google Sheets to a SQLite database file.

4.5.1. Requirements

Following python packages are required to use Google Sheets feature.

Dependency Python package installation:

$ pip install sqlitebiter[gs]

Or

$ sudo pip install gspread
$ sudo pip install oauth2client pyopenssl

4.5.2. Example

Example:
$ sqlitebiter -o sample.sqlite gs credentials-xxxxxxxxxxxx.json samplebook
[INFO] sqlitebiter gs: convert 'samplebook' to 'sheet3' table
[INFO] sqlitebiter gs: convert 'samplebook' to 'sheet1' table
[INFO] sqlitebiter gs: converted results: source=1, success=2, created-table=2
[INFO] sqlitebiter gs: database path: sample.sqlite
Output:
$ sqlite3 sample.sqlite .schema
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NOT EXISTS '_source_info_' ("source_id" INTEGER NOT NULL, "dir_name" TEXT, "base_name" TEXT NOT NULL, "format_name" TEXT NOT NULL, "dst_table" TEXT NOT NULL, size INTEGER, mtime INTEGER);
CREATE TABLE IF NOT EXISTS 'sheet3' (a INTEGER, b REAL, c TEXT);
CREATE TABLE IF NOT EXISTS 'sheet1' (a INTEGER, b REAL, c TEXT);

4.5.3. sqlitebiter gs subcommand help

Usage: sqlitebiter gs [OPTIONS] CREDENTIALS TITLE

  Convert a spreadsheet in Google Sheets to a SQLite database file.

  CREDENTIALS: OAuth2 Google credentials file. TITLE: Title of the Google
  Sheets to convert.

Options:
  -h, --help  Show this message and exit.

  Documentation: https://sqlitebiter.rtfd.io/ Issue tracker:
  https://github.com/thombashi/sqlitebiter/issues