[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

excel mashup

Dave Sailer

8/23/2007 12:05:00 AM

I'm using parseexcel (http://raa.ruby-lang.org/project/p...) 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?
--
Posted via http://www.ruby-....

2 Answers

Todd Burch

8/23/2007 1:10:00 AM

0

Dave Sailer wrote:
> I'm using parseexcel (http://raa.ruby-lang.org/project/p...) 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...

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 Fulton's The Ruby
Way - second edition.

Easy as pie. Pages 706-707.

Todd.
--
Posted via http://www.ruby-....

Dave Sailer

8/23/2007 9:50:00 AM

0

Todd Burch wrote:

>
> I just figured this out the other day when reading Hal Fulton'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.
--
Posted via http://www.ruby-....