Hi Everyone

I need to generate the Excel Sheet through the Ruby On Rails.I have to
create the excel sheet with the database fields as headers and the data
in
the sheet

I installed the required gems…

  • gem install spreadsheet-excel -v = 0.3.5.1*

and i worte the code as

  • wb = Spreadsheet::Excel.new(“E:/RailsApps/application/sample.xls”)
    version = Excel::VERSION*

  •           f4 = Format.new(:num_format => "d mmm yyyy")
              f5 = Format.new(:num_format => 0x0f)
              wb.add_format(f4)
              wb.add_format(f5)*
    
  •            ws1 = wb.add_worksheet("employee")
              header = ['ID','Name','Designation','Salary','JoinDate']
                  len = header.length - 1
             for k in 0..len do
               puts "Header of K #{header[k]}"
               ws1.write(0,k,header[k],f1)
             end
    
  •            rij = 1             #de gegevens worden getoond vanaf 
    

de
2de rij
ws1.write(rij,0,employee.id)
ws1.write(rij,0,employee.name)
ws1.write(rij,0,employee.desg)
ws1.write(rij,0,employee.salary)
ws1.write(rij,0,employee.joindate)*

It is Showing the Following Error :

[DEPRECATED] By requiring ‘spreadsheet/excel’ you are loading a
Compatibility
layer which provides a drop-in replacement for
Spreadsheet::Excel
versions <= 0.3.5.1. This code will be removed in
Spreadsheet
version 1.0.0

Can Anyone PLease help me…