Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

at the office I have a Perl CGI script that parses CSV type data and generates an excel spreadsheet. when I use the IE browser everything works ok : the browser prompts me to open or save the generated data and when I click on "open" excel starts up and properly displays the data. however when the same function is performed using chrome, it only allows me to save the file and when I attempt to run excel on the saved file I get an error message about "bad format of data". I have used several different Perl modules : (1) Spreadsheet::WriteExcel and (2) Excel::Writer::XLSX and the result is the same in both cases, IE is ok and chrome fails. Is there a Perl module to generate an older style "xls" file that my Perl CGI script could use ?

Replies are listed 'Best First'.
Re: Perl CGI generating excel spreadsheet
by Corion (Patriarch) on Aug 04, 2018 at 06:05 UTC

    Also see the cgi.pl example from Spreadsheet::WriteExcel. Maybe you aren't calling binmode in your code?

    If you show us the (short, relevant) code you're using, that helps us give you more concrete advice.

Re: Perl CGI generating excel spreadsheet
by chromatic (Archbishop) on Aug 03, 2018 at 23:30 UTC

    What Content-Type header are you sending for the spreadsheet? Can you post a short, self-contained example which demonstrates the problem?


    Improve your skills with Modern Perl: the free book.