/sheetsdb

Google Sheets as a DataBase

Primary LanguageRuby

SheetsDB: Google Sheets as a DB

It is like Active Record, but with Google Sheets backend in mind 😉

This project uses google_drive for accessing Google Drive and Sheets.

Installation

SheetsDB should work with Ruby 2.4+

Currently installation is available as a standalone project only:

git clone https://github.com/vladyio/sheetsdb
bundle install

Configuration

go to Google API console, do some things there... (to be done)

Usage

Say one needs to create a migration to create a table People:

ruby sheets.db g migration create_table_people

A new migration will be created at db/migrate directory. Open it in your editor, then write the following:

# create table people

SheetsDB::Migration.new do |m|
  m.create_table :people, :age, :first_name, :last_name
end

Then migrate:

ruby sheets.rb m

# In case of success you will see some output:
# => create table: people
#   => columns of people: [:age, :first_name, :last_name]

That's it!

TODO:

  • Add column
  • Remove column
  • Create tables with fields (with create_table)
  • Keep track of migrations in db/schema.rb
    • Add types for fields
    • Add support for foreign keys
  • Drop tables (with drop_table)
  • Drop database (with drop_tabase!)
  • Support for models (ORM, kind of?)