SpreadsheetAccessor
Spreadsheet Accessor.
Installation
Add this line to your application's Gemfile:
gem 'spreadsheet_accessor'
And then execute:
$ bundle
Or install it yourself as:
$ gem install spreadsheet_accessor
Usage
require "spreadsheet_accessor"
p SpreadsheetAccessor.cell( "A1" ) # {:name=>"A1", :row=>0, :col=>0}
p SpreadsheetAccessor.cell( "Z1" ) # {:name=>"Z1", :row=>0, :col=>25}
p SpreadsheetAccessor.cell( "AA1" ) # {:name=>"AA1", :row=>0, :col=>26}
p SpreadsheetAccessor.cell( "ZZ1" ) # {:name=>"ZZ1", :row=>0, :col=>701}
p SpreadsheetAccessor.cell( "AAA1" ) # {:name=>"AAA1", :row=>0, :col=>702}
p SpreadsheetAccessor.cell( "XFD1" ) # {:name=>"XFD1", :row=>0, :col=>16383}
Spreadsheet.open( "./sample.xls", "rb" ){|f|
accessor = SpreadsheetAccessor.new( f.worksheet( "Sheet1" ) )
p accessor.cell( "A1" ) # "TEST"
p accessor.cell( "B1" ) # 111
p accessor.cell( "C1" ) # 222
p accessor.cell( "A2" ) # 333.0
p accessor.cell( "A3" ) # nil
p accessor.cell( "B2" ) # 166.5
p accessor.cell( [ 1, 1 ] ) # 166.5
p accessor.cell( { :row => 1, :col => 1 } ) # 166.5
}
Contributing
- Fork it ( http://github.com//spreadsheet_accessor/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request