Hi, I download an excel file from a web site (export) with a perl script and I save it to my disk. Once that doing, I cannot open the file with Excel. When I open the file get with Perl and the one get by hand, they look slightly different but I cannot find what operation I have to do to make Perl saving (getting?) the Excel file in the correct format. I get the file just simply by :
my $response = $ua->get($reportingOgdFormUrl);
if ($response->is_success) {
	open(XLS, ">extract.xls") or die;
	print XLS $response->content;
	close(XLS);
} else {
	die $response->status_line;
}
By analyzing the network traffic, WireShark tells two wired thinks:
Transfer-Encoding: chunked
Content-Type: application/vnd.ms-excel; charset=UTF-8
I tried to decode using UTF-8 and utf8 but it does'nt give any result. I can send the corrupted file (and the correct one) to anyone that would accept to help me. Regards, Olivier

In reply to Get corrupted Excel file from HTTP by ogerault

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.