Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Spreadsheet::Read Open File from the cloud

by Corion (Pope)
on Sep 30, 2019 at 19:40 UTC ( #11106890=note: print w/replies, xml ) Need Help??

in reply to Spreadsheet::Read Open File from the cloud

You will have to perform the additional step of downloading the file first. This is easy using HTTP::Tiny or LWP::UserAgent:

#!perl use strict; use warnings; use HTTP::Tiny; use Spreadsheet::Read; # Fetch data and return a filehandle to that data sub fetch_url { my( $url ) = @_; my $ua = HTTP::Tiny->new; my $res = $ua->get( $url ); open my $fh, '<', \$res->{content}; return $fh } my $fh = fetch_url(''); my $sheet = Spreadsheet::Read->new( $fh, parser => 'ods' );

Replies are listed 'Best First'.
Re^2: Spreadsheet::Read Open File from the cloud
by vitoco (Friar) on Oct 01, 2019 at 14:09 UTC

    Thanks, it is a very nice piece of code, but it failed as I suspected, because referenced module Spreadsheet::ReadSXC does not support streams. I got this error:

    Sorry, references as input are not (yet) supported by Spreadsheet::ReadSXC at C:\Temp\ line 22.

    Anyway, I could save to a temp file (actually mirrored) and then used it as it previously did.

      The underlying parser may require a path to an actual file (as opposed to a file handle). parser => 'ods' is such a parser. So create one!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11106890]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2019-11-17 12:23 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (86 votes). Check out past polls.