-
Notifications
You must be signed in to change notification settings - Fork 75
Excel facilities
autotelik edited this page Dec 2, 2014
·
3 revisions
Stand Alone Excel Wrapper
Under JRUBY provides wrapper around Apache PO,I which provides advanced features. (http://poi.apache.org/) Under other Rubies uses the spreadsheet gem (https://rubygems.org/gems/spreadsheet)
Usage:
excel = Excel.new()
excel.create_worksheet( :name => "Info" )
row = 0
excel[row, 0] = "START TIME"
excel[row, 1] = "END TIME"
excel.create_worksheet( :name => 'Nacks' )
nacks.each_with_index do |x, i| excel[i, 0] = x end
excel.write('NackReport.xls')
excel.worksheets[0].name.should == "Info"
excel.worksheet(0).name.should == 'Nacks'
r = excel.row(1)
puts "Column o = #{r[0]}"
# existing spreadsheet
sheet = excel.open( 'MyProjects.xls')
puts sheet.name
excel.row(0).each { |col| puts col }