use strict;
use warnings;
use Win32::OLE;
my $xl = Win32::OLE->new('Excel.Application');
$xl->{Visible} = 1;
my $wb = $xl->Workbooks->Add;
my $ws = $wb->Sheets(1);
$ws->Cells(1, 1)->{Value} = "A"; $ws->Cells(1, 2)->{Value} = "E";
$ws->Cells(2, 1)->{Value} = "B";
$ws->Cells(3, 1)->{Value} = "C";
$ws->Cells(4, 1)->{Value} = "D"; $ws->Cells(4, 2)->{Value} = "F";
my $end = $ws->UsedRange->Rows->{Count};
for my $count (1..$end) {
my $cell = $ws->Cells($count, 2);
if ($cell->{Value} eq "") {
$cell->EntireRow->Delete;
}
}
####
use strict;
use warnings;
use Win32::OLE;
my $xl = Win32::OLE->new('Excel.Application');
$xl->{Visible} = 1;
my $wb = $xl->Workbooks->Add;
my $ws = $wb->Sheets(1);
$ws->Cells(1, 1)->{Value} = "A"; $ws->Cells(1, 2)->{Value} = "E";
$ws->Cells(2, 1)->{Value} = "B";
$ws->Cells(3, 1)->{Value} = "C";
$ws->Cells(4, 1)->{Value} = "D"; $ws->Cells(4, 2)->{Value} = "F";
my $end = $ws->UsedRange->Rows->{Count};
for (my $count = $end; $count > 1; $count--) {
my $cell = $ws->Cells($count, 2);
if ($cell->{Value} eq "") {
$cell->EntireRow->Delete;
}
}
####
use strict;
use warnings;
use Win32::OLE;
my $xl = Win32::OLE->new('Excel.Application');
$xl->{Visible} = 1;
my $wb = $xl->Workbooks->Add;
my $ws = $wb->Sheets(1);
$ws->Cells(1, 1)->{Value} = "A"; $ws->Cells(1, 2)->{Value} = "E";
$ws->Cells(2, 1)->{Value} = "B"; $ws->Cells(2, 2)->{Value} = "'";
$ws->Cells(3, 1)->{Value} = "C"; $ws->Cells(3, 2)->{Formula} = '=If(0,"Extremely long formula that in this case evaluates to a zero length string","")';
$ws->Cells(4, 1)->{Value} = "D"; $ws->Cells(4, 2)->{Value} = "F";
my $end = $ws->UsedRange->Rows->{Count};
for (my $count = $end; $count > 1; $count--) {
my $cell = $ws->Cells($count, 2);
if ($cell->{Value} eq "") {
$cell->EntireRow->Delete;
}
}
####
use strict;
use warnings;
use Win32::OLE;
my $xl = Win32::OLE->new('Excel.Application');
$xl->{Visible} = 1;
my $wb = $xl->Workbooks->Add;
my $ws = $wb->Sheets(1);
$ws->Cells(1, 1)->{Value} = "A"; $ws->Cells(1, 2)->{Value} = "E";
$ws->Cells(2, 1)->{Value} = "B"; $ws->Cells(2, 2)->{Value} = "'";
$ws->Cells(3, 1)->{Value} = "C"; $ws->Cells(3, 2)->{Formula} = '=If(0,"Extremely long formula that in this case evaluates to a zero length string","")';
$ws->Cells(4, 1)->{Value} = "D"; $ws->Cells(4, 2)->{Value} = "F";
my $end = $ws->UsedRange->Rows->{Count};
for (my $count = $end; $count > 1; $count--) {
my $cell = $ws->Cells($count, 2);
if (!defined($cell->{Value})) {
$cell->EntireRow->Delete;
}
}