Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by GotToBTru (Prior)
on May 27, 2015 at 13:35 UTC ( [id://1127998]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1127998]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-23 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found