This code is used to calculate no. of w/s in excel file and read the worksheets' name.
my $sheetcnt = $Book->Worksheets->Count();
foreach (1..$sheetcnt){
print "\t" .$Book->Worksheets($_)->{Name} ."\n";
}
While last row and column can be read by using this:-
Finding the last Column and Row
my $LastRow = $Sheet->UsedRange->Find({What=>"*",
SearchDirection=>xlPrevious,
SearchOrder=>xlByRows})->{Row};
my $LastCol = $Sheet->UsedRange->Find({What=>"*",
SearchDirection=>xlPrevious,
SearchOrder=>xlByColumns})->{Column};
All of above code are use Win32::OLE without using complicated spreadsheet perl module.
Reference
1. http://www.perlmonks.org/?node_id=153486
2. http://www.ngbdigital.com/perl_ole_excel.html
3. http://perlguru.com/
Monday, October 17, 2011
Extract Excel contents from perl
Posted by AG at 7:56 PM 0 comments
Labels: Codes, Excel, Perl, Win32::OLE
Tuesday, October 4, 2011
Subscribe to:
Posts (Atom)