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][$col]->{Val}; if ( $cell eq "Column Heading" ) { $val_col=$col; print "OKAY: found column values as below\n"; my $res = $sheet->{Cells}[$rowCnt][$col]->{Val}; #Reads each value for the column print $res, "\n"; next; } if ($val_col eq $col ) { print $cell, "\n"; push (@col_arr, $cell); } foreach $cell (@data){ print "into new loop\n"; } } } }