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

Easy as pie.  Pages 706-707.

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