use strict; use warnings; use Win32::OLE; my $xl = Win32::OLE->new('Excel.Application'); $xl->{Visible} = 1; my $nShtsOld = $xl->{SheetsInNewWorkbook}; $xl->{SheetsInNewWorkbook} = 1; my $wb = $xl->Workbooks->Add; $xl->{SheetsInNewWorkbook} = $nShtsOld; my $sht = $wb->Sheets(1); $sht->Cells(1, 1)->{Value} = "A"; $sht->Cells(1, 2)->{Value} = "E"; $sht->Cells(2, 1)->{Value} = "B"; $sht->Cells(3, 1)->{Value} = "C"; $sht->Cells(4, 1)->{Value} = "D"; $sht->Cells(4, 2)->{Value} = "F"; my $end = $sht->UsedRange->Rows->{Count}; for (my $count = $end; 0 < $count; $count--) { my $cell = $sht->Cells($count, 2); if (!defined $cell->{Value}) {$cell->EntireRow->Delete} }