kiranv has asked for the wisdom of the Perl Monks concerning the following question:
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");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "write" problem with "Spreadsheet::WriteExcel" Module
by ig (Vicar) on Oct 07, 2013 at 10:24 UTC | |
by soonix (Chancellor) on Oct 07, 2013 at 14:07 UTC | |
by kiranv (Initiate) on Oct 08, 2013 at 06:51 UTC | |
|
Re: "write" problem with "Spreadsheet::WriteExcel" Module
by 2teez (Vicar) on Oct 07, 2013 at 10:30 UTC | |
|
Re: "write" problem with "Spreadsheet::WriteExcel" Module
by Anonymous Monk on Oct 07, 2013 at 06:35 UTC | |
by kiranv (Initiate) on Oct 08, 2013 at 06:50 UTC |