class SpreadsheetToJson::Spreadsheet
Attributes
spreadsheet[R]
Public Class Methods
new(options = {})
click to toggle source
Initalize the spreadsheet with options hash inlcuding access_token and spreadsheet_key
# File lib/spreadsheet_to_json/spreadsheet.rb, line 7 def initialize(options = {}) if options.empty? puts "Please pass the parameter options with keys of access_token and spreadsheet_key" exit end session = GoogleDrive.login_with_oauth(options[:access_token]) @spreadsheet = session.spreadsheet_by_key(options[:spreadsheet_key]) end
Public Instance Methods
get_sheet_by_id(worksheet_id=0)
click to toggle source
Get a sheet by worksheet's id
# File lib/spreadsheet_to_json/spreadsheet.rb, line 18 def get_sheet_by_id(worksheet_id=0) spreadsheet.worksheets[worksheet_id] end
get_sheet_by_name(worksheet_name)
click to toggle source
Get a sheet by a worksheet's name
# File lib/spreadsheet_to_json/spreadsheet.rb, line 23 def get_sheet_by_name(worksheet_name) spreadsheet.worksheet_by_title(worksheet_name) end