use warnings; use strict; use 5.012; use FindBin qw($Bin); use Win32::OLE qw(in with); # Script runs in the same location as the Excel file sub has_hyperlinks { my $rge = shift; my $return_val = do { if ($rge->{Hyperlinks}->{Count}) { 1 } else { 0 } }; return $return_val; } my $ExcelFile = $Bin . "/Book1.xlsx"; my $Workbook = Win32::OLE->GetObject( $ExcelFile ) or die "Could not load $ExcelFile. \n"; my $Excel = $Workbook->{Application}; $Excel->{Visible} = 1; $Excel->{DisplayAlerts} = 0; my $Worksheet = $Workbook->Worksheets("Sheet1"); if (has_hyperlinks($Worksheet->Range( "D5" ))){ print "Range location has hyperlinks"; } else { print "It doesn't!" }