xlsx
authorkilian (ksmachome) <ksaffran@dks.lu>
Fri, 8 Nov 2019 08:20:54 +0000 (09:20 +0100)
committerkilian (ksmachome) <ksaffran@dks.lu>
Fri, 8 Nov 2019 08:20:54 +0000 (09:20 +0100)
dev/parseexcel.pl [new file with mode: 0644]
dev/parsexlsx.pl [new file with mode: 0644]

diff --git a/dev/parseexcel.pl b/dev/parseexcel.pl
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dev/parsexlsx.pl b/dev/parsexlsx.pl
new file mode 100644 (file)
index 0000000..c07b9e4
--- /dev/null
@@ -0,0 +1,55 @@
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
+
+use strict;
+use Text::Iconv;
+use Spreadsheet::XLSX;
+use Data::Dumper;
+#my $converter = Text::Iconv -> new ("utf-8", "windows-1251");
+my $xlsxfile = "/Volumes/mirror/Porta Nova 2019_xx.xlsx";
+my $excel = Spreadsheet::XLSX -> new ($xlsxfile);
+my $points = (); 
+my $cols = ();
+my $startrow = 0;
+foreach my $sheet (@{$excel -> {Worksheet}}) {
+       if ($sheet->{Name} eq "periode0607"){
+       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});
+                          #  if ($cell -> {Val} eq "Nom"){
+                          #    $cols->{$col} = "name";
+                          #    $startrow = $row +1;
+                          #  }
+                          #  if (($cell -> {Val} =~ /OLR/) && ($row == $startrow-1)){
+                          #    my ($n) = $cell -> {Val} =~ m/.*(\d+).*/;
+                          #    $cols->{$col} = "rl".$n;
+                          #  }
+                          #  if ((exists($cols->{$col}) ) && ($row > $startrow) && ($startrow != 0)){
+                          #    if ($cell -> {Val} ne "0"){
+                          #      $points->{$row}->{$cols->{$col}} = $cell->{Val};
+                          #    }
+                          #  }
+                       }
+                       
+               }
+       }
+       }
+} 
+
+foreach my $k (%{$points}){
+  if (keys(%{$points->{$k}}) > 1){
+    print Dumper($points->{$k});
+  }
+}
+#print Dumper($points);