Name Error in Excel Uninitalized Contant in 'roo'
excel, ruby, ruby-on-rails, ruby-on-rails-3, spreadsheet
Solution
Try `Roo::Excel.new`
Or `Roo::Spreadsheet.new`
Problem
I am trying to read an Excel file in Ruby On Rails. I have done coding like this for reading the cell content from the Excel sheet. ``` def test require 'rubygems' require 'iconv' require 'roo' s = Excel.new("C:/Sites/hmmsapp/Book1.xls") s.default_sheet = s.sheets.first 1.upto(4) do |line| roll = s.cell(line,'A') puts "#{roll} -------------" end end ``` But on running this it always gives me this error. ``` NameError in HostelController#test uninitialized constant HostelController::Excel ``` I have also included `iconv` as per suggestions for this problem. But there is no change in error. Please give some light to removing this error & to read the excel file properly.