writeexcel tool for ruby

excel write example

require 'rubygems'require 'writeexcel'# Create a new Excel Workbookworkbook = Spreadsheet::WriteExcel.new('ruby.xls')# Add worksheet(s)worksheet  = workbook.add_worksheetworksheet2 = workbook.add_worksheet# Add and define a formatformat = workbook.add_formatformat.set_boldformat.set_color('red')format.set_align('right')# write a formatted and unformatted string.worksheet.write(1, 1, 'Hi Excel.', format)  # cell B2worksheet.write(2, 1, 'Hi Ruby.')           # cell B3# write a number and formula using A1 notationworksheet.write('B4', 3.14159)worksheet.write('B5', '=SIN(B4/4)')# write to fileworkbook.close