Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.0.1
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (22 sloc) 0.711 kb
require 'rubygems'
require 'active_support/all'
require 'google_spreadsheet'
require File.expand_path('lib/sheet_mapper')
class GradeMapper < SheetMapper::Base
columns :topic, :grade, :score
def valid_row?
self[:topic].present? && @pos > 3
end
# Convert is_notable to boolean
def score
self[:score].to_i
end
end
sheet = SheetMapper::Spreadsheet.new(:mapper => GradeMapper, :key => ENV['SHEET_KEY'], :login => ENV['SHEET_LOGIN'], :password => ENV['SHEET_PASS'])
collection = sheet.find_collection_by_title('data')
name = collection.cell(1, 2)
age = collection.cell(2, 2)
puts "Name: #{name}, Age: #{age}"
bubbles = collection.each do |bubble|
p bubble.attributes
end
Jump to Line
Something went wrong with that request. Please try again.