I've pulled an Excel spreadsheet off a website using the following snippet:

my $EXCEL = new Spreadsheet::ParseExcel; my $URL = "http://www.sysco.com/supplier/DUNS%20Listing.xls"; my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new(GET => $URL); my $response = $ua->request($req); if ( $response->is_error() ) { printf " %s\n", $response->status_line; } else { my $CONTENT = $response->content();<br> my $BYTES = length $CONTENT;<br> print "$URL successfully retrieved! [$BYTES] bytes...\n"; }
Which seems to work just fine, I get 9000+ bytes back, and $CONTENT is definitely binary.

Now, the problem.
I'm trying to parse $CONTENT, using the Spreadsheet::Excel module, as I need to get to a couple of the columns in the xls file.

How do I do this? I've never dealt with writing binary files, and can't seem to trick the $EXCEL->Parse('some_xls_file') statement into using $CONTENT.

What's the best way to accomplish this?
Any help is appreciated.

Edit, BazB: added code tags, reformatted slightly.


In reply to HTTP::Response and Spreadsheet::ParseExcel by jarp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.