Skip to content

Instantly share code, notes, and snippets.

@randomutterings
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randomutterings/ca004a732c66fe90c342 to your computer and use it in GitHub Desktop.
Save randomutterings/ca004a732c66fe90c342 to your computer and use it in GitHub Desktop.
Google Sheets with roo and roo-google
require 'roo-google'
# Setup your key and credentials
key = "googleSheetsUniqueId"
user = "user@domain.com"
password = "mysupersecretpassword"
gsheet = Roo::Google.new(key, user: user, password: password)
rows = gsheet.first_row..gsheet.last_row
columns = gsheet.first_column..gsheet.last_column
# iterate over each row in the spreadsheet
rows.each do |row|
columns.each do |column|
puts "Value at [#{row},#{column}] is: #{gsheet.cell(row, column)}"
end
end
gem 'roo', github: 'roo-rb/roo'
gem 'roo-google', github: 'roo-rb/roo-google'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment