Excel mashup

I’m using parseexcel (http://raa.ruby-lang.org/project/parseexcel/) to
read some excel files from a website after manually downloading them.
I’d like to avoid the download and read them directly off the web but
can’t see how to do this. parseexcel uses File.open which requires a
disk file I guess. In java there are high level interfaces that allow
you to treat any type of data as an io stream.

is there something I’m missing here? another way to do this?

Dave S. wrote:

I’m using parseexcel (http://raa.ruby-lang.org/project/parseexcel/) to
read some excel files from a website after manually downloading them.
I’d like to avoid the download and read them directly off the web but
can’t see how to do this. parseexcel uses File.open which requires a
disk file I guess. In java there are high level interfaces that allow
you to treat any type of data as an io stream.

is there something I’m missing here? another way to do this?

Here’s a little code to get you started:

require ‘open-uri’ ;

script = nil ;
result = nil ;

page = “http://www.google.com

begin ;
result = open(page) {|w| script = w.readlines } ;
rescue => e ;
puts “e=#{e}, e.class=#{e.class}” ;
result = [] ;
end ;

puts “result class=#{result.class}, count=#{result.length}” ; #,
data=#{result}" ;
puts “result[0] =>#{result[0].chomp}<=” if result[0] ;

I just figured this out the other day when reading Hal F.'s The Ruby
Way - second edition.

Easy as pie. Pages 706-707.

Todd.

Todd B. wrote:

I just figured this out the other day when reading Hal F.'s The Ruby
Way - second edition.

Easy as pie. Pages 706-707.

Todd.

thanks!
how is that book? I’ve found the pick axe a bit cryptic.

Hi Dave,

On 23/08/07, Dave S. [email protected] wrote:

I’m using parseexcel (http://raa.ruby-lang.org/project/parseexcel/) to
read some excel files from a website after manually downloading them.
I’d like to avoid the download and read them directly off the web but
can’t see how to do this. parseexcel uses File.open which requires a
disk file I guess. In java there are high level interfaces that allow
you to treat any type of data as an io stream.

is there something I’m missing here? another way to do this?

you could use the Roo-Gem (http://roo.rubyforge.org/). In the new
version
0.5.1 it supports reading sheets from an http:// address.

-Thomas


Thomas P.
[email protected]
[email protected]
030- 49 78 37 06
0176 - 75 03 03 04


http://www.thopre.com/

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