No type library matching "Microsoft Excel" found at D:\Genes_datasets\exp.pl line 4
Win32::OLE(0.16): GetOleTypeLibObject() Not a Win32::OLE::TypeLib object at C:/Perl/site/lib/Win32/OLE/Const.pm line 45.
Died at D:\Genes_datasets\exp.pl line 6.
i don't ve microsoft excel but open office installed, i think that could be a problem. But these files ve been saved in microsoft excel 97/2000/XP format
my code is
Expand|Select|Wrap|Line Numbers
- use strict;
- use Win32::OLE;
- use Win32::OLE qw(in with);
- use Win32::OLE::Const 'Microsoft Excel';
- # get already active Excel application or open new
- my $Excel = Win32::OLE->GetActiveObject('Excel.Application')|| die;
- # storing the names of excel files present in the folder
- my $dir="D:/Genes_datasets/";
- opendir (DH, $dir) or die "cannot open the $dir !!!";
- my @dir_files=readdir DH;
- closedir DH;
- my @excel_files=grep(/.xls/,@dir_files);
- #print "@excel_files\n";
- # reading all excel files
- foreach (@excel_files) {
- open Excel file
- my $excelfile=$dir.$_;
- print "$excelfile\n";
- my $book = $Excel->Workbooks->Open($excelfile);
- my $sheet= $book->Worksheets("Sheet1");
- $sheet->Activate();
- my $rowval = $sheet->Range("a1")->{Value};
- print "$_\t$rowval\n";
- }