lib/roo/google.rb in roo-1.3.5 vs lib/roo/google.rb in roo-1.3.6
- old
+ new
@@ -107,14 +107,11 @@
@gs.authenticate(user, password)
@sheetlist = @gs.sheetlist
#-- ----------------------------------------------------------------------
#-- TODO: Behandlung von Berechtigungen hier noch einbauen ???
#-- ----------------------------------------------------------------------
-
- if self.sheets.size == 1
- @default_sheet = self.sheets.first
- end
+ @default_sheet = self.sheets.first
end
# returns an array of sheet names in the spreadsheet
def sheets
@sheetlist
@@ -239,56 +236,17 @@
}
}
theformulas
end
- # returns all values in this row as an array
- # row numbers are 1,2,3,... like in the spreadsheet
- def row(rownumber,sheet=nil)
- sheet = @default_sheet unless sheet
- read_cells(sheet) unless @cells_read[sheet]
- result = []
- tmp_arr = []
- @cell[sheet].each_pair {|key,value|
- y,x = key.split(',')
- x = x.to_i
- y = y.to_i
- if y == rownumber
- tmp_arr[x] = value
- end
- }
- result = tmp_arr[1..-1]
- while result[-1] == nil
- result = result[0..-2]
- end
- result
- end
-
# true, if the cell is empty
def empty?(row, col, sheet=nil)
value = cell(row, col, sheet)
return true unless value
return false if value.class == Date # a date is never empty
return false if value.class == Float
return false if celltype(row,col,sheet) == :time
value.empty?
- end
-
- # returns all values in this column as an array
- # column numbers are 1,2,3,... like in the spreadsheet
- #--
- #TODO: refactoring nach GenericSpreadsheet?
- def column(columnnumber, sheet=nil)
- if columnnumber.class == String
- columnnumber = GenericSpreadsheet.letter_to_number(columnnumber)
- end
- sheet = @default_sheet unless sheet
- read_cells(sheet) unless @cells_read[sheet]
- result = []
- first_row(sheet).upto(last_row(sheet)) do |row|
- result << cell(row,columnnumber,sheet)
- end
- result
end
# sets the cell to the content of 'value'
# a formula can be set in the form of '=SUM(...)'
def set_value(row,col,value,sheet=nil)