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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.