lib/squib/api/data.rb in squib-0.5.1 vs lib/squib/api/data.rb in squib-0.6.0
- old
+ new
@@ -22,18 +22,18 @@
# @return [Hash] a hash of arrays based on columns in the spreadsheet
# @api public
def xlsx(opts = {})
opts = Squib::SYSTEM_DEFAULTS.merge(opts)
opts = Squib::InputHelpers.fileify(opts)
- s = Roo::Excelx.new(opts[:file])
+ s = Roo::Excelx.new(opts[:file])
s.default_sheet = s.sheets[opts[:sheet]]
data = {}
s.first_column.upto(s.last_column) do |col|
header = s.cell(s.first_row,col).to_s
data[header] = []
- (s.first_row+1).upto(s.last_row) do |row|
+ (s.first_row + 1).upto(s.last_row) do |row|
cell = s.cell(row,col)
- # Roo hack for avoiding unnecessary .0's on whole integers
+ # Roo hack for avoiding unnecessary .0's on whole integers (https://github.com/roo-rb/roo/issues/139)
cell = s.excelx_value(row,col) if s.excelx_type(row,col) == [:numeric_or_formula, 'General']
data[header] << cell
end#row
end#col
data