Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

RFC Tutorial - Deleting Excel Rows, Columns and Sheets

by davies (Parson)
on Feb 06, 2012 at 21:49 UTC ( #952167=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
                                      $sht->Cells(2, 2)->{Value} = 'b';
    $sht->Cells(3, 1)->{Value} = 'c'; $sht->Cells(3, 2)->{Value} = 'c';
    $sht->Cells(1, 2)->Delete({Shift=>xlUp});
    
  2. or download this
    use strict;
    use warnings;
    ...
                                      $sht->Cells(2, 2)->{Value} = 'b';
    $sht->Cells(3, 1)->{Value} = 'c'; $sht->Cells(3, 2)->{Value} = 'c';
    $sht->Cells(1, 2)->EntireRow->Delete;
    
  3. or download this
    use strict;
    use warnings;
    ...
        my $cell = $sht->Cells($count, 2);
        if (!defined $cell->{Value}) { $cell->EntireRow->Delete; } 
    }
    
  4. or download this
    use strict;
    use warnings;
    ...
        my $cell = $sht->Cells($count, 2);
        if (!defined $cell->{Value}) {$cell->EntireRow->Delete} 
    }
    
  5. or download this
    use strict;
    use warnings;
    ...
    $xl->{SheetsInNewWorkbook} = $nShtsOld;
    
    $wb->Sheets(1)->Delete;
    
  6. or download this
    use strict;
    use warnings;
    ...
    for my $nSht(2..3) {
        $wb->Sheets($nSht)->Delete;
    }
    
  7. or download this
    use strict;
    use warnings;
    ...
    for (my $nSht = 3; 1 < $nSht; $nSht--) {
        $wb->Sheets($nSht)->Delete;
    }
    
  8. or download this
    use strict;
    use warnings;
    ...
    for my $nSht (2..$wb->Sheets->{Count}) {
        $wb->Sheets(2)->Delete;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://952167]
Approved by ww
Front-paged by Arunbear
help
Chatterbox?
[Corion]: But LPW was enjoyable, even though it's always a bit hectic due to cramming everything into one day
[Corion]: I have no feeling about how my talk was received, but I'm happy with it, which counts the most to me ;-D
[Corion]: Also, London is always a nice visit, as I got to meet a friend there, and spent some time offline, working on "minor" features of the shadertoy thing ;)
[marto]: maybe next year when the kids are a little older I'll have time to attend perl events in Europe
[Corion]: marto: Yeah - there isn't a Perl Day-Care at Perl events - we thought about it for YAPC::Europe 2012 but it's a gigantic effort to organize that

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2016-12-07 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (125 votes). Check out past polls.