It is documented behavior.

"Care should be taken with the values that are substituted. The formula returned by repeat_formula() contains several other tokens in addition to those in the formula and these might also match the pattern that you are trying to replace."

Try this instead:

#!/usr/local/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("test.xls"); my $worksheet = $workbook->addworksheet("foo"); my $formula = $worksheet->store_formula('=SUBTOTAL(9,A1:B1)'); foreach my $row (0..99) { $worksheet->write($row,0,$row+1); $worksheet->write($row,1,$row+1); $worksheet->repeat_formula($row,2,$formula,undef,qr/A1\b/,'A'.($row+ +1),qr/B1\b/,'A'.($row+2)); $worksheet->repeat_formula($row,3,$formula,undef,qr/A1\b/,'B'.($row+ +1),qr/B1\b/,'B'.($row+2)); }


In reply to Re: Bug in Spreadsheet::WriteExcel? by Mr. Muskrat
in thread Bug in Spreadsheet::WriteExcel? by thor

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.