1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/usr/bin/perl use strict; use warnings; use OpenOffice::OODoc; my $file = "export.ods"; my $doc = odfDocument(file => $file) or die $!; my $lastrow = 0; my $lastcol = 0; my $ws = 0; # Das erste Worksheet (kann man auch loopen) for my $row (0..1048575) { $lastrow = $row if $row > $lastrow; last unless defined $doc->getCellValue($ws, $row, 0); for my $col (0..1023) { $lastcol = $col if $col > $lastcol; last unless defined $doc->getCellValue($ws, $row, $col); } } print "Anzahl Zeilen: $lastrow\nAnzahl Spalten: $lastcol";
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#!/usr/bin/perl use strict; use warnings; use OpenOffice::OODoc; use Data::Dumper; my $file = "export.ods"; my $doc = odfDocument(file => $file) or die $!; my @alldata; for my $ws (0..255) { last unless defined $doc->getCellValue($ws, 0, 0); for my $row (0..1048575) { last unless defined $doc->getCellValue($ws, $row, 0);; for my $cell (0..1023) { last unless defined $doc->getCellValue($ws, $row, $cell); $alldata[$ws]->[$row]->[$cell] = $doc->getCellValue($ws, $row, $cell); } } } print Dumper \@alldata; print "rows: " . @{$alldata[0]} . "\ncols: " . @{$alldata[0]->[0]};