Skip to content

mericson/tablespoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tablespoon

Access Google Spreadsheets in a vaguely record-like way.

Requirements

  • Google Spreadsheet that is organized like a database table. Fieldnames in the first row, records in the rest of the rows.

Installation

sudo gem install tablespoon

How to Use

require 'rubygems'
require 'tablespoon'

Connect to a Google doc

doc   = Tablespoon::Doc.new( "0ArhhvPZdTe-WdGpZQ3pEY1hDcEUxWmxwNnJEQ3g4aVE", 
                         :username => google_username, :password => google_password )

Get a worksheet either by name or by id. (Coming soon: Optionally, declare an id field so you can find rows by id later.)

rows = doc.get_table 'Sheet1', :id_field => 'last-name'

Loop thru rows and retrieve data

rows.each do |r|
  puts r['full-name']    
end

Modify fields and save data back to the spreadsheet.

rows.each do |r|
  r['full-name'] = r['full-name'].upcase
end

Copyright © 2013 Matt Ericson. See LICENSE.txt for further details.

About

Use Google Spreadsheets as your CMS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages