Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hi All

I was create a program which produce some data.Now i use the Spreadsheet::WriteExcel to store the data.But i need some more fexible way to store the data.
use Spreadsheet::WriteExcel; my $workbook =Spreadsheet::WriteExcel->new("final_status.xls"); $worksheet = $workbook->add_worksheet(); $format = $workbook->add_format(); $format->set_bold(); $format->set_color('Blue'); $format->set_align('center'); $col = $row = 0; $worksheet->set_column( 0, 0, 20 ); #Serial No $worksheet->set_column( 1, 1, 15 ); #Test ID $worksheet->set_column( 2, 2, 15 ); # Status $worksheet->set_column( 3, 3, 15 ); # Total $worksheet->set_column( 4, 4, 15 ); # Pass $worksheet->write(A1,"Serial No:", $format); $worksheet->write(B1,"Testcase ID:", $format); $worksheet->write(C1,"Status:", $format); $worksheet->write(D1,"Total:", $format); $worksheet->write(D3,"Total Pass:", $format); $worksheet->write(D4,"Total Fail:", $format); $worksheet->write(E1,"Result:", $format); # Manual Entry $worksheet->write(C2, "pass"); $worksheet->write(C3, "fail"); $worksheet->write(C4, "pass"); $worksheet->write(C5, "fail"); $worksheet->write(C6, "fail"); $worksheet->write(C7, "fail"); $worksheet->write(C8, "fail"); $worksheet->write(C9, "fail"); ##########code to store the data in row wise my $row=3; my $col=0; my $slno=1; my $testid='00A'; my $status='pass'; $worksheet->write($row,$col,$status); my $array_ref; my @array = ($slno, $testid, $status); $array_ref = \@array; $worksheet->write_row($row, $col, $array_ref); ###Formula To claculat the total $worksheet->write('E3', '=COUNTIF(C2:C9,"pass")'); $worksheet->write('E4', '=COUNTIF(C2:C9,"FAIL")');

Here i manually enter the data.So i think about the other way to implement the same.

1.How can i create a subroutine so that from my main program i pass the 3 value and catch it and write the value in excel sheet.As i not sure about the usges of write_row in subroutine.

In case of formula the row and column not taking the variable.As i need to write the result in last row and last column.

Any hint ,suggestion will help a lot

In reply to Create a excel sheet with formula ??? by samirpatry

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!
  • 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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (14)
    As of 2015-07-29 11:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (263 votes), past polls