#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; # Set the filename and send the content type my $filename ="cgitest.xls"; print "Content-type: application/vnd.ms-excel\n"; # The Content-Disposition will generate a prompt to save the file. If +you want # to stream the file to the browser, comment out the following line. print "Content-Disposition: attachment; filename=$filename\n"; print "\n"; # Create a new workbook and add a worksheet. The special Perl filehand +le "-" # will redirect the output to STDOUT # my $workbook = Spreadsheet::WriteExcel->new("-"); my $worksheet = $workbook->addworksheet(); # Write to the workbook $worksheet->write(0, 0, "Hi Excel!");
There is also the Spreadsheet::WriteExcel::FromDB module which allows you to create Excel files directly from a DB query.
You will find some other suggestions about how to create Excel files here.
--
John.
In reply to Re: export a table to excel
by jmcnamara
in thread export a table to excel
by beginner_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |