Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

RFC Tutorial - Deleting Excel Rows, Columns and Sheets

by davies (Vicar)
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-09-18 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls