httptech has asked for the wisdom of the Perl Monks concerning the following question:
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:
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?use OLE; my $count; my $xl = CreateObject OLE 'Excel.Application' || die $!; my $workbook = $xl->Workbooks->Open("C:\\test.xls"); my $worksheet = $workbook->Worksheets(1); my $array = $worksheet->Range("A1:B10")->{'Value'}; for (@$array) { print ++$count, ":", join(",", @$_), "\n" } $xl->ActiveWorkbook->Close(0); $xl->Quit();
I tried my $rows = $worksheet->Rows(); but that seems to return a reference to something that isn't a scalar.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: OLE - Getting all rows from Excel
by t0mas (Priest) on May 10, 2000 at 12:00 UTC | |
by httptech (Chaplain) on May 10, 2000 at 15:28 UTC | |
by t0mas (Priest) on May 11, 2000 at 14:02 UTC | |
by httptech (Chaplain) on May 11, 2000 at 16:08 UTC | |
Re: OLE - Getting all rows from Excel
by Anonymous Monk on May 10, 2000 at 00:10 UTC | |
by raflach (Pilgrim) on May 10, 2000 at 00:12 UTC | |
Re: OLE - Getting all rows from Excel
by lhoward (Vicar) on May 10, 2000 at 01:51 UTC |
Back to
Seekers of Perl Wisdom