I needed to work with excel files to fill in some details. So I preferred "Spreadsheet::WriteExcel" which has very good interfaces and documentation. Thank you.. Now I had to write an utility which fills in Excel sheet according to my requirement. So whatever functionalities(functions ex: writeCell) required for me are kept in that utility(excelUtil.pm) file so that those functions can be called from wherever(from other files like testExce.pl) required. Sample files are attached - testExcel.pl and excelUtil.pm When I am executing testExcel.pl, "write" function is not writing to excel file if "writeCell" is called from testExcel.pl. If "write " is called from "excelUtil.pm", then it is writing properly. Requesting you to help me regarding this
excelUtil.pm
package excelUtil; use Exporter; use strict; use Spreadsheet::WriteExcel; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(writeCell); ## Excel workbook my $workbook = Spreadsheet::WriteExcel->new("Sample.xls"); ## worksheet my $worksheet = $workbook->add_worksheet("test"); ## Functions sub writeCell { my ($row, $col, $str) = @_; print "Writing Cell \n"; $worksheet->write($row, $col, $str); } writeCell(1, 2, "testing, Row-1, Col-2"); 1;
testExcel.pl
#!/usr/bin/perl use excelUtil; writeCell(1, 1, "Testing, Row-1, Col-1");
In reply to "write" problem with "Spreadsheet::WriteExcel" Module by kiranv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |