On Jun 7, 12:16 am, jimsgib...@gmail.com (Jim Gibson) wrote: > On Jun 6, 2012, at 11:33 AM, rbm wrote: > > > > > > > > > > > Hi, > > > I'm using perl module Spreadsheet::ParseExcel here > >http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spr.... > > > I have a Excel spreadsheet which has 8 worksheets in and I would like > > to parse just worksheets 3 and 4. > > > I've tried amending this line in my script every which way but with no > > joy. > > > for my $worksheet ( $workbook->worksheets() ) { > > > The documentation says that the worksheets() method returns an array > > of worksheets but I cant seem to reference any of these in the usual > > way in order to syphon out the worksheets that I don't need either. > > > When I print out $worksheet I get > > > Spreadsheet::ParseExcel::Worksheet=HASH(0x61e3d0) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9b9b0) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ba60) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cab0) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cb40) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cbd0) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cc60) > > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ccf0) > > The worksheets() method returns an array of worksheet objects. You can then > call methods on the worksheet object to extract data from that worksheet. > > You can retrieve a specific worksheet object either by name or by index (0-7 > in your case). > > Please see the documentation for the Spreadsheet::ParseExcel module, > specifically the Workbook section that describes the worksheets() and > worksheet() methods.
Hi, Thanks for responding. I have looked at the documentation. I am able to get the methods to return one worksheet or all the worksheets in my workbook but I am unable to find a solution to get either worksheet() or worksheets() to return just 2 of the worksheets. I've tried for my $worksheet ( $workbook->worksheet(3) .. $workbook- >worksheet(4)) { for my $worksheet ( $workbook->worksheet(3 .. 4)) { for my $worksheet ( $workbook->worksheets(3 .. 4)) { I've also tried for my $worksheet ( $workbook->worksheets()) { which apparently returns array of worksheet objects but I am unable to reference any of these individually e.g. $worksheet [3] so that I can exclude the worksheets I don't want. It may be that neither of these methods support any of the things I am trying to do, but I just wanted to double check I'm using them correctly before I attempt to find a more long winded solution. Thanks again for your help with this. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/