Home > Archive > PERL Miscellaneous > November 2004 > export to excel
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| I would like write to Excel file the result of a query on a db table
with a CGI Perl. My CGI allows output to HTML table by Template.pm
module; can you help me?
With Java it's very easy
response.setContentType("application/vnd.ms-excel")
But with Perl? In the same script I want allow output in html and
output in excel file (user choices). Can I do it using Template.pm
module?
Hi
ocap
| |
|
| "ocap" <ocap8891@yahoo.it> wrote in message
news:c4495e9e.0411280102.3e882960@posting.google.com...
> I would like write to Excel file the result of a query on a db table
> with a CGI Perl. My CGI allows output to HTML table by Template.pm
> module; can you help me?
> With Java it's very easy
>
> response.setContentType("application/vnd.ms-excel")
>
> But with Perl? In the same script I want allow output in html and
> output in excel file (user choices). Can I do it using Template.pm
> module?
>
> Hi
> ocap
Not sure about the Template.pm as I haven't used it, but you could just
write the results from your query out to a .csv file. This would be Excel
friendly and very easy to import.
| |
| James Willmore 2004-11-29, 4:05 pm |
| On Sun, 28 Nov 2004 13:57:00 +0000, Leon wrote:
> "ocap" <ocap8891@yahoo.it> wrote in message
> news:c4495e9e.0411280102.3e882960@posting.google.com...
> Not sure about the Template.pm as I haven't used it, but you could just
> write the results from your query out to a .csv file. This would be Excel
> friendly and very easy to import.
Or, in Perl, you could just send the proper header ....
#"quick and dirty" in the main script using the template
print "Content-type: application/vnd.ms-excel\n\n";
#using the CGI module in the main script using the template
print header(-type => 'application/vnd.ms-excel');
#-or-
print $query->header(-type => 'application/vnd.ms-excel');
HTH
Jim
| |
| James Willmore 2004-11-29, 4:05 pm |
| On Sun, 28 Nov 2004 01:02:54 -0800, ocap wrote:
> I would like write to Excel file the result of a query on a db table
> with a CGI Perl. My CGI allows output to HTML table by Template.pm
> module; can you help me?
> With Java it's very easy
>
> response.setContentType("application/vnd.ms-excel")
>
> But with Perl? In the same script I want allow output in html and
> output in excel file (user choices). Can I do it using Template.pm
> module?
Or, in Perl, you could just send the proper header ....
#"quick and dirty" in the main script using the template
print "Content-type: application/vnd.ms-excel\n\n";
#using the CGI module in the main script using the template
print header(-type => 'application/vnd.ms-excel');
#-or-
print $query->header(-type => 'application/vnd.ms-excel');
HTH
Jim
|
|
|
|
|