Count Coulmns in Excel file


#1

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


#2

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


#3

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


#4

2008/12/4 Ganesh G. removed_email_address@domain.invalid:

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