use Spreadsheet::ParseExcel; sub extractXLS { # parameter my $exceldir = shift; my $excelfile = shift; my $OUTPUT = shift; my $wksh = shift; binmode( $OUTPUT,":utf8" ); # begin my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($exceldir.$excelfile); my($iR, $iC, $oWkS, $oWkC); my $oWkS = $oBook->worksheet($wksh); #print "--------- SHEET:", $oWkS->{Name}, "\n"; for( my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++ ) { my $rec=''; for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++ ) { my $temp = ''; $oWkC = $oWkS->{Cells}[$iR][$iC]; $temp = $oWkC->Value if($oWkC); $rec = $rec.$temp.";"; } chop($rec); $rec = $rec,"\r"; print $OUTPUT $rec,"\n"; } }