Count Coulmns in Excel file

Hi,
  How to count the number of columns in an excel file....
and i am using "Spreadsheet::ParseExcel" gem to parse the excel file

if anybody knows plz reply me

advanced thanks
Ganesh

···

--
Posted via http://www.ruby-forum.com/.

I don't know how to do this, but maybe you can find something on the Ruby on
Windows blog in the articles related to Excel.

Regards,
Craig

Ganesh Ganesh wrote:

  How to count the number of columns in an excel file....
and i am using "Spreadsheet::ParseExcel" gem to parse the excel file

the ParseExcel-Gem is deprecated - please use its shiny new replacement:
gem install spreadsheet

and use Worksheet#dimensions:
http://spreadsheet.rubyforge.org/classes/Spreadsheet/Worksheet.html#M000197

hth

cheers
Hannes

···

--
Posted via http://www.ruby-forum.com/\.

in my 'roo' gem (http://rubyforge.org/projects/roo/\):

···

2008/12/4 Ganesh Ganesh <ganesh.dc@gmail.com>:

Hi,
How to count the number of columns in an excel file....
and i am using "Spreadsheet::ParseExcel" gem to parse the excel file

if anybody knows plz reply me

---------
require 'rubygems'
require 'roo'

s = Excel.new("test/numbers1.xls")
s.default_sheet = s.sheets.first
puts "first column: #{s.first_column}"
puts "last column: #{s.last_column}"
puts "number of non empty colums: #{s.last_column-s.first_column+1}"
puts "number of colums from 'A' to last column: #{s.last_column}"
-----------

-Thomas

--
Thomas Preymesser
thopre@gmail.com