Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hello monks, I am having a problem getting my script to write formulas for subtraction. Here is my code:
$sth = $dbh->prepare($query); $sth->execute(); # create new excel file with 2 worksheets my $xWB = Spreadsheet::WriteExcel->new('trusmart_billing_201302.xls'); my $xWS = $xWB->add_worksheet('Summary'); #set formats my $format = $xWB->add_format(); $format->set_bold(); $xWS->set_column('A:A', 20); $xWS->set_column('E:E', 20, $format); $xWS->set_column('C:C', 20, $format); $xWS->set_column('B:B', 20, $format); my $xWS2 = $xWB->add_worksheet('Details'); #set columns A through D $xWS2->set_column('A:D', 20); # Add column headers for first worksheet my $R=0; my $C=0; $xWS->write($R, $C++, $_) for @{$sth->{NAME}}; # Read the query results and write them into the spreadsheet while (my $ar=$sth->fetchrow_arrayref) { ++$R; $C=0; $xWS->write($R, $C++, $_) for @$ar; } $xWS->write(0,5, 'Additional Images'); $xWS->write_formula('E2', '=(D2-B2)'); $xWS->write_formula('E3', '=(D3-B3)'); $xWS->write_formula('E4', '=(D4-B4)'); $xWS->write_formula('E5', '=(D5-B5)'); $xWS->write_formula('E6', '=1+5'); # as a test, this also did not work

It is writing 0 as the results in the E column cells. why? Thank you for your input

In reply to spreadsheet formula issue by PerlSufi

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
  • Outside of code tags, you may need to use entities for some characters:
            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 avoiding work at the Monastery: (10)
    As of 2014-07-30 06:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (229 votes), past polls