ralph has asked for the wisdom of the Perl Monks concerning the following question:
I have not found a way to get the individual values out of $array. Everything works OK if the range is a single value, like "A1". However, when I change the range to something like ("A1:B10") I get errors or senseless data.#!/usr/bin/perl use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors. +.. my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); # get already ac +tive Excel # application or + open new #my $Book = $Excel->Workbooks->Open("C:\\DOCUMENTS\\test.xls"); # open + Excel file my $Book = $Excel->Workbooks->Openmy $Sheet = $Book->Worksheets(1); + # select worksheet number 1 my $array = $Sheet->Range("A1:B10")->{'Value'}; # get the conte +nts $Book->Close;
I suspect that I'm not indexing $array correctly, but I've not been able to figure out why, in spite of hours of searching through tutorials.
I would appreciate any help a more experienced monk could give as to how I can get to the individual values that I have extracted from the spreadsheet into $array.
Many thanks, and sorry about the long post.
Ralph
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I access the values of an "array" extracted using Range
by NetWallah (Canon) on Feb 19, 2012 at 07:27 UTC | |
|
Re: How can I access the values of an "array" extracted using Range
by CountZero (Bishop) on Feb 19, 2012 at 17:26 UTC | |
by ralph (Initiate) on Feb 20, 2012 at 04:21 UTC | |
|
Re: How can I access the values of an "array" extracted using Range
by oko1 (Deacon) on Feb 19, 2012 at 15:42 UTC | |
by ralph (Initiate) on Feb 20, 2012 at 04:16 UTC |