use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $Excel = Win32::OLE->new('Excel.Application','Quit') or die "Cannot open Excel\n"; my $Book = $Excel->workbooks->Open(FileName => "foo.xlsx", ReadOnly => 1) or die "Cannot open Spreadsheet\n"; my $num_sheets = $Book->Sheets->Count; for my $sheet_num ( 1 .. $num_sheets ) { my $Sheet = $Book->worksheets( $sheet_num ); my $max_col = $Sheet->UsedRange->SpecialCells( xlCellTypeLastCell )->Column; my $max_row = $Sheet->UsedRange->SpecialCells( xlCellTypeLastCell )->Row; for my $row ( 1 .. $max_row ) { for my $col ( 1 .. $max_col ) { print "I found it in Sheet $sheet_num Cell $row,$col\n" if ( $Sheet->Cells( $row, $col )->Value =~ /cabbage/ ); } } }