gube has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I am having the data's in excel sheet. I have to retrieve the data to perl. How to get the data's using win32::ole or anyother method. please provide the sample code.

Thanks in advance.

Regards,
Gubendran.L

  • Comment on How to retreive data's from excel to perl ?

Replies are listed 'Best First'.
Re: How to retreive data's from excel to perl ?
by mifflin (Curate) on Apr 07, 2005 at 06:02 UTC
Re: How to retreive data's from excel to perl ?
by jbrugger (Parson) on Apr 07, 2005 at 06:14 UTC
    You can read an Excel sheet like this (code snip)
    ... use Spreadsheet::ParseExcel; my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($file); my $oWkS = $oBook->{Worksheet}[0]; for(my $i = $oWkS->{MinRow}+1 ; defined $oWkS->{MaxRow} && $i <= $oWkS +->{MaxRow} ; $i++) { my $oWkC1 = $oWkS->{Cells}[$i][0]; } ...
    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

      If all you need to do is extract raw data from an Excel sheet I find Spreadsheet::ParseExcel::Simple saves typing and is far easier to read. YMMV:

      my $xls = Spreadsheet::ParseExcel::Simple->read( 'spreadsheet.xls' ); foreach my $sheet ($xls->sheets) { while ($sheet->has_data) { print join( ', ', $sheet->next_row ), "\n"; } }
Re: How to retreive data's from excel to perl ?
by friedo (Prior) on Apr 07, 2005 at 06:11 UTC
Re: How to retreive data's from excel to perl ?
by VSarkiss (Monsignor) on Apr 07, 2005 at 14:23 UTC