Forum: Ruby Count Coulmns in Excel file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ada0fa9f326acbba88da65d76f675aca?d=identicon&s=25 Ganesh Ganesh (ganesh_bangalore)
on 2008-12-04 09:45
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
B14575f0ca69f10938fdd67e7156e0e1?d=identicon&s=25 Craig Demyanovich (Guest)
on 2008-12-04 14:57
(Received via mailing list)
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
9d0207c91dd4cbc7e7b5f5be98c85e2b?d=identicon&s=25 Hannes Wyss (spreadsheet)
on 2008-12-05 15:35
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/Spreadshe...

hth

cheers
Hannes
Cd6b438f1238ee36cf4daecbae1d3917?d=identicon&s=25 Thomas Preymesser (Guest)
on 2009-01-11 02:00
(Received via mailing list)
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

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 topic is locked and can not be replied to.