Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Perl and Microsoft Excel

by wackattack (Sexton)
on Aug 20, 2005 at 00:16 UTC ( #485334=perlquestion: print w/replies, xml ) Need Help??

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

I need to parse data and then pump them into Excel spreadsheets. I have a website set up that allows the person to adjust the parsing and then it pumps data out into tab delimited text. Is there anyway I can finish the process and have it change to an Excel file?

Thanks for the help monks

Replies are listed 'Best First'.
Re: Perl and Microsoft Excel
by Roger (Parson) on Aug 20, 2005 at 00:27 UTC
      ***deleted because I am a moron****
Re: Perl and Microsoft Excel
by dragonchild (Archbishop) on Aug 20, 2005 at 03:03 UTC
    Excel::Template was built for this exact purpose. It has the same API as HTML::Template (and PDF::Template, for that matter) and will gladly provide either a file or a buffer for CGI.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Perl and Microsoft Excel
by davidrw (Prior) on Aug 20, 2005 at 00:53 UTC
    As mentioned, first look should be Spreadsheet::WriteExcel (assuming you're not going to fake it out w/a csv file/excel mime type). Also look at the node Index of Spreadsheet FAQs that is a good compilation of spreadsheet-related nodes, modules, and links.
Re: Perl and Microsoft Excel
by jimX11 (Friar) on Aug 20, 2005 at 01:10 UTC

    Maybe you could get away with simply setting the content type specification to application/ in the HTTP headers.

    Something like:

    Content-Type: application/; name='excel'
    Content-Disposition: attachment; filename=foo.xls

    Then send a csv data as the content. It's a hack, but it's simple.

Re: Perl and Microsoft Excel
by wink (Scribe) on Aug 20, 2005 at 00:34 UTC

    Unless there are commas in your fields, you could comma-delimit it and save is as a .csv (comma-seperated value) file.

      Even if there are commas in your data, you can save it as a CSV file. Use one of the CSV modules on CPAN to handle it right.

      And, if you don't think there are commas in your data, just wait. They tend to sneak in there on friday nights and the first days of vacation. :)

      brian d foy <>
Re: Perl and Microsoft Excel
by VSarkiss (Monsignor) on Aug 20, 2005 at 16:24 UTC
Re: Perl and Microsoft Excel
by jbullock35 (Hermit) on Aug 20, 2005 at 21:58 UTC

    davies kindly categorized a lot of Perl-and-spreadsheet information in Index of Spreadsheet FAQs, including a great deal of information on generating spreadsheets with Spreadsheet::WriteExcel and Win32::OLE.

    I use Spreadsheet::WriteExcel a lot and find it a pleasure. And I've never seen a better-documented module.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://485334]
Approved by Roger
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2023-02-05 17:24 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (32 votes). Check out past polls.