excel mashup

D

Dave Sailer

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?
 
T

Todd Burch

Dave said:
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.
 
D

Dave Sailer

Todd said:
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.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top