=head1 VERSION
-Version 0.01
+Version 0.02
=cut
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 SYNOPSIS
my ($db,$size) = $open_db(
path => '/path/to/workbook.xls'
worksheet => 'name of sheet',
+ from => 42,
+ to => 9999,
}
C<worksheet> is case and white-space insensitive name of worksheet in Excel
file to use. If not specified, it will use first worksheet in file.
+C<from> and C<to> specify row numbers to start and finish import.
+
=cut
my $sheet;
+my ($from,$to);
sub open_db {
my $self = shift;
my $name;
do {
$sheet = shift @{ $workbook->{Worksheet} };
+ $log->logdie("can't find sheet '$wanted_worksheet' in $arg->{path}\n") unless (defined($sheet));
$name = $sheet->{Name};
$name =~ s/\s\s+/ /g;
} until ($name =~ m/^\s*\Q$wanted_worksheet\E\s*$/i);
}
- $size = $sheet->{MaxRow} - $sheet->{MinRow};
+ $from = $arg->{from} || $sheet->{MinRow};
+ $to = $arg->{to} || $sheet->{MaxRow};
+
+ $size = $to - $from;
$log->warn("opening Excel file '$arg->{path}', using ",
$wanted_worksheet ? '' : 'first ',
my $rec;
- my $row = $sheet->{MinRow} + $mfn - 1;
+ my $row = $from + $mfn - 1;
$log->debug("fetch_rec( $mfn ) row: $row cols: ",$sheet->{MinCol}," - ",$sheet->{MaxCol});