Created
August 29, 2013 14:23
-
-
Save jeffa/6378762 to your computer and use it in GitHub Desktop.
Transpose Excel docs from "portrait" to "landscape."
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Math::Matrix qw(transpose); | |
use Spreadsheet::ParseExcel::Simple; | |
use Spreadsheet::WriteExcel::Simple; | |
my $xls = Spreadsheet::ParseExcel::Simple->read('old.xls'); | |
my @data; | |
for ($xls->sheets) { | |
while ($_->has_data) { | |
push @data, [$_->next_row]; | |
} | |
} | |
my $matrix = Math::Matrix->new(@data); | |
my $ss = Spreadsheet::WriteExcel::Simple->new; | |
$ss->write_row($_) for @{$matrix->transpose}; | |
open OUT,'>','new.xls'; | |
binmode OUT; | |
print OUT $ss->data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment