Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- # with a "grep" in terminal you can search words in a excel
- use strict;
- use warnings;
- use Text::Iconv;
- my $converter = Text::Iconv -> new ("utf-8", "windows-1251");
- # Text::Iconv is not really required.
- # This can be any object with the convert method. Or nothing.
- use Spreadsheet::XLSX;
- my $excel = Spreadsheet::XLSX -> new ('/Sistemas/direccionamiento.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};
- printf "\n";
- foreach my $col ($sheet -> {MinCol} .. $sheet -> {MaxCol}) {
- my $cell = $sheet -> {Cells} [$row] [$col];
- if ($cell) {
- # printf("( %s , %s ) => %s\n", $row, $col, $cell -> {Val});
- printf("%s ", $cell -> {Val});
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment