I am not sure how to get it to use all the rows with just using "\@mydata". I modified the code to work, but it is very inefficient. Can anyone think of a more efficient way to resolve this issue without using a loop? The code is below:
# Our data that we will add to the workbook... @mydata = ("Item", "Category", "Price"); @mydata1 = ("Nails", "Hardware", "5.25"); @mydata2 = ("Shirt", "Clothing", "23.00"); @mydata3 = ("Hammer", "Hardware", "16.25"); @mydata4 = ("Sandwich", "Food", "5.00"); @mydata5 = ("Pants", "Clothing", "31.00"); @mydata6 = ("Drinks", "Food", "2.25"); # Write all the data at once... $rngt = $xlBook->ActiveSheet->Range("A1:C7"); $rng = $xlBook->ActiveSheet->Range("A1:C1"); $rng1 = $xlBook->ActiveSheet->Range("A2:C2"); $rng2 = $xlBook->ActiveSheet->Range("A3:C3"); $rng3 = $xlBook->ActiveSheet->Range("A4:C4"); $rng4 = $xlBook->ActiveSheet->Range("A5:C5"); $rng5 = $xlBook->ActiveSheet->Range("A6:C6"); $rng6 = $xlBook->ActiveSheet->Range("A7:C7"); $rng->{Value} = \@mydata; $rng1->{Value} = \@mydata1; $rng2->{Value} = \@mydata2; $rng3->{Value} = \@mydata3; $rng4->{Value} = \@mydata4; $rng5->{Value} = \@mydata5; $rng6->{Value} = \@mydata6;

In reply to Re^3: OLE write to Excel by NewMonk2Perl
in thread OLE write to Excel by NewMonk2Perl

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.