From 8fc846b02f32f0f701525e356f6544958cd0d43d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 9 Oct 2013 09:57:32 -0400 Subject: support worksheets with a range selection --- lib/Spreadsheet/ParseXLSX.pm | 12 ++++++++++-- 1 file 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 ]; -- cgit v1.2.3-54-g00ecf