export to excel

O

ocap

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
 
L

Leon

ocap said:
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.
 
J

James Willmore

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
 
J

James Willmore

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top