Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: How to create a csv file on the fly in Perl?

    Hello, how can I go about generating a csv file and sending it to a user without actually writing the file to the webserver's hard disk? I currently create a csv from some tables and store it on my webserver, then push it to the user with a self.location javascript tag. This sucks, because if someone were to get the URL of the csv they could just grab the last created copy.

    How can I use perl to generate and send csv's on the fly? I've seen php examples, but can't get them ported properly to perl. Any help is greatly appreciated.

    Thanks!

    - WJB

  2. #2
    Join Date
    Mar 2004
    Posts
    5
    Oh yeah and I'd like to do it without adding a new module, hard to get that approved.

    Thanks!

    - WJB

  3. #3
    Join Date
    Mar 2004
    Posts
    5
    I got it to work with this code and no modules at all:
    print "Content-type: application/msexcel\n";
    print "Content-disposition: inline; filename=\"test.csv\"\n";
    print "Pragma: no-cache\n";
    print "Expires: 0\n\n";

    The simple key was to not double-break (\n\n) until I finished printing the headers.

    Thanks all,

    - WJB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •