Created
June 4, 2014 02:57
-
-
Save zsan/471888f52803ce4e2020 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env perl | |
use Spreadsheet::XLSX; | |
use Modern::Perl; | |
use Text::Iconv; | |
my $converter = Text::Iconv -> new ("utf-8", "windows-1251"); | |
my $excel = Spreadsheet::XLSX -> new ('file.xlsx', $converter); | |
foreach my $sheet (@{$excel->{Worksheet}}) { | |
printf("Sheet: %s\n", $sheet->{Name}); | |
$sheet->{MaxRow} ||= $sheet->{MinRow}; | |
foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) { | |
$sheet->{MaxCol} ||= $sheet->{MinCol}; | |
foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) { | |
my $cell = $sheet->{Cells}[$row][$col]; | |
if ($cell) { | |
printf("( %s , %s ) => %s\n", $row, $col, $cell->{Val}); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment