[ANN] Spreadsheet::ParseExcel

H

Hannes Wyss

Spreadsheet::parseExcel - Get information from an Excel file.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Version: 0.3.2
Date: 2005-12-15

Short Description:
Spreadsheet::parseExcel allows you to get information out of a simple Excel=
file
This Package is an - as of today incomplete - translation of Kawai
Takanoris Perl-Module.


Requirements
------------

* ruby 1.8

Install
-------

De-Compress archive and enter its top directory.
Then type:

$ ruby setup.rb config
$ ruby setup.rb setup
($ su)
# ruby setup.rb install

You can also install files into your favorite directory
by supplying setup.rb some options. Try "ruby setup.rb --help".


Usage
-----
workbook =3D Spreadsheet::parseExcel.parse(path_to_file)
worksheet =3D workbook.worksheet(0)
worksheet.each(1) { |row|
puts row.at(0)
}


License
-------

LGPL


URL: http://download.ywesee.com/parseexcel
Author: Hannes Wyss <[email protected]>

Enjoy, and thanks for your feedback!
Hannes
 
A

Anu Sebastian

Hi,

I am using ruby ruby 1.8.6 and spreadsheet (0.6.4).
I am trying to oarse an excel file.
My code is like :

require 'rubygems'
require 'spreadsheet'
require 'parseexcel'
equire 'parseexcel/parseexcel'
require 'parseexcel/parser'

workbook =
Spreadsheet::parseExcel.parse("public/downloads/commissions/google/test.xls")
worksheet = workbook.worksheet(0)

worksheet.each { |row|
puts row.at(0).to_s

}

But it prints 'nil'. I have data in my excel file.

Could you please help me?

Thanks,
Anu
 
N

Norman Smith

Anu said:
Hi,

I am using ruby ruby 1.8.6 and spreadsheet (0.6.4).
I am trying to oarse an excel file.
My code is like :

require 'rubygems'
require 'spreadsheet'
require 'parseexcel'
equire 'parseexcel/parseexcel'
require 'parseexcel/parser'

workbook =
Spreadsheet::parseExcel.parse("public/downloads/commissions/google/test.xls")
worksheet = workbook.worksheet(0)

worksheet.each { |row|
puts row.at(0).to_s

}

nil usually means empty rows. Also each row is an array of cells. You
could use inspect instead of to_s to see what's really there. This is
how I get data from a spreadsheet:

ws.each { |row|
if row != nil
#
# cycle over each cell in this row if it's not an empty row
#
row.each { |cell|
if cell != nil
contents = cell.to_s('latin1')
puts("Cell Contents: #{contents}\n")
end
}
end
}
 
A

Anu Sebastian

Hi,

Thanks for the response.
My excel file has data in it. When i give row.inspect i get the
following :
#<Spreadsheet::Excel::Row:0xffffffdbd3f67a
@worksheet=#<Spreadsheet::Excel::Worksheet:0xb70d75fc> @height=
@hidden=false @default_format= @outline_level=0 @formats= @idx=0 []>

But it doesn't print anything inside the loop
Any idea?

Thanks,
Anu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top