<?xml version="1.0" encoding="windows-1252"?>
<node id="10799" title="OLE - Getting all rows from Excel" created="2000-05-09 19:30:16" updated="2005-08-12 18:14:08">
<type id="115">
perlquestion</type>
<author id="5021">
httptech</author>
<data>
<field name="doctext">
Nearly every example I can find of using OLE to manipulate
Excel spreadsheets shows me I can use the "Range" method to
define a set of values I can get with an array reference:
&lt;code&gt;use OLE;

my $count;
my $xl = CreateObject OLE 'Excel.Application' || die $!;
my $workbook = $xl-&gt;Workbooks-&gt;Open("C:\\test.xls");
my $worksheet = $workbook-&gt;Worksheets(1);
my $array = $worksheet-&gt;Range("A1:B10")-&gt;{'Value'};

for (@$array) { print ++$count, ":", join(",", @$_), "\n" }

$xl-&gt;ActiveWorkbook-&gt;Close(0);
$xl-&gt;Quit();
&lt;/code&gt;
But I haven't seen any examples of reading the entire worksheet
at once. How can I find out how many rows (and columns, less importantly)
I'm dealing with?
&lt;p&gt;
I tried &lt;code&gt;my $rows = $worksheet-&gt;Rows();&lt;/code&gt; but that
seems to return a reference to something that isn't a scalar.
</field>
</data>
</node>
