CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Unable to create spreadsheet in cgi script: Edit Log



giridhar276
Novice

Jul 4, 2013, 6:57 PM


Views: 1165
Unable to create spreadsheet in cgi script

hi folks,

I am trying to download xlsx from cgi page in browser but not sure where I made a mistake.

the cgi script contains the code for creating xlsx and just by clicking on the image I should be able to



Code
#!/usr/bin/perl -w 
use Excel::Writer::XLSX;
use DBI;
use DBD::mysql;
use CGI;
use CGI qw(:standard);
use CGI::Carp qw ( fatalsToBrowser );

$q=new CGI;


$report_year = $q->param('Field_year');
$report_month = $q->param('Field_month');
$report_year = $q->param('Field_year');
$string="$report_month"." "."$report_year"." "."Network Availability Report";

$report_name="Network_Availability_Report_".$report_month."_".$report_year.".xlsx";

my $workbook = Excel::Writer::XLSX->new("$report_name");
my $worksheet = $workbook->add_worksheet($report_month);


print "Content-type: text/html\n\n";
print '<html>';
print '<head>';
print '<title>Hello Word - First CGI Program</title>';
print '</head>';
print '<body>';
print "<h2>$report_month</h2>";
print "<h2>$report_year</h2>";
#print qq~<a href="http://25.209.200.143/$report_name"><img src="http://25.209.200.143/tcs/images/xlsx.png" width=40 height=40></a>~;
print '</body>';
print '</html>';

1;


If I click on the image then I need to open the spreadsheet.

I have managed to execute the same in windows and able to display it on windows.

Now I am deploying the code in unix but failed to display this cgi script.

Error


Code
  
Can't call method "add_worksheet" on an undefined value at /srv/www/cgi-bin/gnsncc/temp_final_report.cgi line 20.


I made sure that all the scripts has 755 permissions.

I am executing the scripts from cgi-bin folder.


Could anyone please let me know what went wrong.

Regards,
J


(This post was edited by giridhar276 on Jul 4, 2013, 7:02 PM)


Edit Log:
Post edited by giridhar276 (Novice) on Jul 4, 2013, 7:02 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives