Excell sheet is not writing data on it

29 views
Skip to first unread message

jraj...@broadsoft.com

unread,
Jun 22, 2015, 12:47:25 PM6/22/15
to spreadsheet...@googlegroups.com

Below is my package

#!/usr/bin/perl

package PSmart::Results;
use Spreadsheet::WriteExcel;

sub new{
 my ($class,$file) = @_;
        if(-s $file){
        print "$file already exist. Please check\n";
        exit;
        }else{
        my $worksheet = createsheet($file);
        bless $worksheet, $class;
        return $worksheet;
        }
}

sub createsheet  {
        my $file = shift;
        my $workbook = Spreadsheet::WriteExcel->new($file);
        my $traffic =  $workbook->add_worksheet('traffic');
        #$traffic->write(0,0,'Test');
        #my $smfdata = $workbook->add_worksheet('smfdata');
        #my $sipdump = $workbook->add_worksheet('sipdump');
        #my $header = $workbook->add_format();
         #  $header->set_bold();
         #  $header->set_size(12);
          # $header->set_color('blue');
        my $worksheet = {
                'traffic' => $traffic,
                };
        return $worksheet;
}
sub writetrafic {
        my ($self,$row,$data) = @_;
        $self->{'traffic'}->write(1, 0, "jegadeesh");
}
1;

From my pl script i called write trafic subroutine and try to write data in the sheet. but its not happen. Please guide me.

Thanks,
Jegadeesh


This email is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. If you are not the intended recipient and have received this email in error, please notify BroadSoft, Inc. immediately by replying to this message, and destroy all copies of this message, along with any attachment, prior to reading, distributing or copying it.

jmcnamara

unread,
Jun 22, 2015, 12:50:30 PM6/22/15
to spreadsheet...@googlegroups.com, jraj...@broadsoft.com

On Monday, 22 June 2015 17:47:25 UTC+1, jrajangam wrote:

From my pl script i called write trafic subroutine and try to write data in the sheet. but its not happen. Please guide me.



Hi,

You probably need to call workbook->close(). Perhaps add a close() method to your class to close the workbook.

John
Reply all
Reply to author
Forward
0 new messages