use CGI; my $cgi = CGI->new (); my $js = <<'JS'; function reportCreate() { var currenturl = document.URL; var url = "https://autoreport.com:8001/cgi-bins/createReport.pl?url="+currenturl; window.location.href = url ; return 1; } JS print qq{}; print $cgi->a({-href=>"javascript:void(0);", -onclick => "reportCreate();" }, 'Create Report
'); print qq{}; ## some Table html code here...please assume print qq{
Name}; print qq{
}; #### use Spreadsheet::WriteExcel; use HTML::TableExtract qw(tree); require LWP::UserAgent; my $filename = "/home/user/report.xls"; # The excel generation using Spreasheet # The table extraction as element using TableExtract # All fine till now , and the excel is getting generated # with the desired content. # But this below piece of code is not working, please let me know how to make it work : open(FILE, "<$filename ") || die "Unable to download file \n"; my @fileholder; binmode FILE; @fileholder = ; close (FILE); print "Content-Type:application/vnd.ms-excel\n"; print "Content Disposition:attachment;filename=report.xls\n\n"; print @fileholder;