No commit activity in last 3 years
No release in over 3 years
A library to read/write files/spreadsheets in Google Drive/Docs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.8.0

Runtime

!= 1.5.1, != 1.5.2, >= 1.4.4
>= 0.3.6
>= 0.5.0
 Project Readme

This is a Ruby 1.8/1.9 library to read/write files/spreadsheets in Google Drive/Docs.

NOTE: This is NOT a library to create Google Drive App.

How to install¶ ↑

$ sudo gem install google_drive

How to use¶ ↑

Example to read/write files in Google Drive:

require "rubygems"
require "google_drive"

# Logs in.
# You can also use OAuth. See document of
# GoogleDrive.login_with_oauth for details.
session = GoogleDrive.login("username@gmail.com", "mypassword")

# Gets list of remote files.
for file in session.files
  p file.title
end

# Uploads a local file.
session.upload_from_file("/path/to/hello.txt", "hello.txt", :convert => false)

# Downloads to a local file.
file = session.file_by_title("hello.txt")
file.download_to_file("/path/to/hello.txt")

# Updates content of the remote file.
file.update_from_file("/path/to/hello.txt")

Example to read/write spreadsheets:

require "rubygems"
require "google_drive"

# Logs in.
# You can also use OAuth. See document of
# GoogleDrive.login_with_oauth for details.
session = GoogleDrive.login("username@gmail.com", "mypassword")

# First worksheet of
# https://docs.google.com/spreadsheet/ccc?key=pz7XtlQC-PYx-jrVMJErTcg
ws = session.spreadsheet_by_key("pz7XtlQC-PYx-jrVMJErTcg").worksheets[0]

# Gets content of A2 cell.
p ws[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.
for row in 1..ws.num_rows
  for col in 1..ws.num_cols
    p ws[row, col]
  end
end

# Yet another way to do so.
p ws.rows  #==> [["fuga", ""], ["foo", "bar]]

# Reloads the worksheet to get changes by other clients.
ws.reload()

API document: gimite.net/doc/google-drive-ruby/

Source code¶ ↑

github.com/gimite/google-drive-ruby

The license of this source is “New BSD Licence”

Supported environments¶ ↑

Ruby 1.8.x and Ruby 1.9.x. Checked with Ruby 1.8.7 and Ruby 1.9.3.

Author¶ ↑

Hiroshi Ichikawa - gimite.net/en/index.php?Contact