#!/usr/bin/perl -w use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Spreadsheet::WriteExcel; $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Open("c:\\perl\\copy of BK11.xls"); my $Sheet = $Book->Worksheets(1); my $count=0; foreach my $row (1..3226) { foreach my $col (1..14) { if (!defined($Sheet->Cells($row,$col)->{'Value'})) { $Sheet->Cells($row,$col)->EntireRow->Delete; $count++; } } }