#use strict; use Spreadsheet::ParseExcel; my $FileName = "/home/dujnne/praice/excel/test.xls"; my $excel = Spreadsheet::ParseExcel::Workbook->Parse($FileName) or die "Unable to open $FileName\n"; #locate columns in the spreadsheet from which we want to extract data my $found = 0; my ($rowCnt, $colCnt) = (0,0); foreach my $sheet (@{$excel->{Worksheet}}) { printf("Sheet: %s\n", $sheet->{Name}); $sheet->{MaxRow} ||= $sheet->{MinRow}; $rowCnt = $sheet->{MinRow}; foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) { $sheet->{MaxCol} ||= $sheet->{MinCol}; $colCnt = $sheet->{MinCol}; foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) { my $cell = $sheet->{Cells}[$row][$colCnt]; if ( lc $cell->{Val} eq "class" ) { $found = 1; print "OKAY: found the column as "class"\n"; print "INFO: searching for all classes \n"; $colCnt++; } if ( $found ) { print $sheet->{Cells}[$row][$colCnt]->{Val}, "\n"; next; } } } $found = 0; }