in reply to Re^2: PERL : Parse/Open an excel file and replace the negative values in a sheet to '0'
in thread PERL : Parse/Open an excel file and replace the negative values in a sheet to '0'

See this article - note the warnings

That link also contains links to numerous example programs. I'm not here to do your homework for you. But I will be happy to help you troubleshoot code you have written.

Dum Spiro Spero
  • Comment on Re^3: PERL : Parse/Open an excel file and replace the negative values in a sheet to '0'

Replies are listed 'Best First'.
Re^4: PERL : Parse/Open an excel file and replace the negative values in a sheet to '0'
by DarshanS (Initiate) on May 28, 2015 at 05:34 UTC

    Infact my problem is something else. If i am able to get the logic for the question i have asked for, i would be able to resolve. As far i came till now on this. Just incase if you would like to help.!

    use warnings; use Spreadsheet::ParseExcel::SaveParser; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('Test.xls'); my $worksheet = $workbook->worksheets(1); my $row = 4; my $col = 5; my $cell = $worksheet->get_cell( $row, $col ); #print $cell,"\n"; print "value = ",$cell->value(), "\n"; my $cell_value = cell->value(); if($cell_value < 0 ) { $cell_value = 0; } $workbook->SaveAs( 'Test_Parse.xls' );

      Looks good. To make the change to the worksheet, you need to add

      $worksheet->write($row,$col,$cell_value);

      I can't be sure that's exactly right, since I don't have those Spreadsheet modules installed. But it should be close.

      Dum Spiro Spero