I have a perl program running on Windows Server 2003/IIS6.0 that should just open an excel report file in the client's browser and let them save it. The code worked on a server running 2000/IIS5.0, but not on this new server. The excel file is created and then saved on the server, not the client. I am using the following sample code to test opening excel on the client:
use strict; use CGI ':standard'; use CGI::Carp qw/fatalsToBrowser/; use DBD::ODBC; use strict; use List::Util qw[min max]; #use warnings; use Spreadsheet::WriteExcel; my $filename = "mydata.xls"; # generated on-the-fly print "Content-disposition: attachment;filename=$filename\n"; print "Content-type: application/vnd.ms-excel\n\n"; my $workbook = Spreadsheet::WriteExcel->new("-"); my $worksheet = $workbook->add_worksheet(); $worksheet->write(0, 0, "Hello"); $worksheet->write(0, 1, "world");
The code runs, but it looks like the output is printed to the web page, not excel. It has been awhile since I setup a site to use perl/cgi script. Have I missed a security setting somewhere in IIS, do you have any suggestions? Thanks. Greg

In reply to Creating Excel File with Perl by gb123z

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.