diff options
-rw-r--r-- | lib/Spreadsheet/ParseXLSX.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm index e202ccb..4f28376 100644 --- a/lib/Spreadsheet/ParseXLSX.pm +++ b/lib/Spreadsheet/ParseXLSX.pm @@ -237,8 +237,16 @@ sub _parse_sheet { my ($selection) = $sheet_xml->find_nodes('//selection'); if ($selection) { - my $cell = $selection->att('activeCell'); - $sheet->{Selection} = [ $self->_cell_to_row_col($cell) ]; + if (my $cell = $selection->att('activeCell')) { + $sheet->{Selection} = [ $self->_cell_to_row_col($cell) ]; + } + elsif (my $range = $selection->att('sqref')) { + my ($topleft, $bottomright) = $range =~ /([^:]+):([^:]+)/; + $sheet->{Selection} = [ + $self->_cell_to_row_col($topleft), + $self->_cell_to_row_col($bottomright), + ]; + } } else { $sheet->{Selection} = [ 0, 0 ]; |