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

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.

http://rubyonwindows.blogspot.com/search/label/excel

Regards,
Craig

Ganesh G. 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

2008/12/4 Ganesh G. [email protected]:

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

in my ‘roo’ gem (http://rubyforge.org/projects/roo/):

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs