This is a Ruby 1.8/1.9 library to read/write Google Spreadsheet.
$ gem sources -a http://gems.github.com $ sudo gem install gimite-google-spreadsheet-ruby
Example:
require"rubygems"require"google_spreadsheet"# Logs in.session = GoogleSpreadsheet.login("username@gmail.com", "mypassword") # First worksheet of http://spreadsheets.google.com/ccc?key=pz7XtlQC-PYx-jrVMJErTcg&hl=enws = session.spreadsheet_by_key("pz7XtlQC-PYx-jrVMJErTcg").worksheets[0] # Gets content of A2 cell.pws[2, 1] #==> "hoge"# Changes content of cells. Changes are not sent to the server until you call ws.save().ws[2, 1] = "foo"ws[2, 2] = "bar"ws.save() # Dumps all cells.forrowin1..ws.num_rowsforcolin1..ws.num_colspws[row, col] endend# Yet another way to do so.pws.rows#==> [["fuga", ""], ["foo", "bar]]# Reloads the worksheet to get changes by other clients.ws.reload()
API document: gimite.net/gimite/rubymess/google-spreadsheet-ruby/
github.com/gimite/google-spreadsheet-ruby/tree/master
The license of this source is “New BSD Licence”
Ruby 1.8.x and Ruby 1.9.x. Checked with Ruby 1.8.7 and Ruby 1.9.1.
Hiroshi Ichikawa - gimite.net/en/index.php?Contact