my $excel_handle = Spreadsheet::ParseExcel->new( CellHandler => \&get_cell_data, NotSetCell => 1 ); my $current_book = {}; sub get_cell_data { my ($book, $sheet, $row, $col, $cell) = @_; $current_book->{Worksheet}[$sheet]->{Cells}[$row][$col]->{Val} = $cell->{Val}; $current_book->{Worksheet}[$sheet]->{MaxRow} = $row if (!(defined($current_book->{Worksheet}[$sheet]->{MaxRow})) or ($current_book->{Worksheet}[$sheet]->{MaxRow} < $row)); $current_book->{Worksheet}[$sheet]->{MinRow} = $row if (!(defined($current_book->{Worksheet}[$sheet]->{MinRow})) or ($current_book->{Worksheet}[$sheet]->{MinRow} > $row)); $current_book->{Worksheet}[$sheet]->{MaxCol} = $col if (!(defined($current_book->{Worksheet}[$sheet]->{MaxCol})) or ($current_book->{Worksheet}[$sheet]->{MaxCol} < $col)); $current_book->{Worksheet}[$sheet]->{MinCol} = $col if (!(defined($current_book->{Worksheet}[$sheet]->{MinCol})) or ($current_book->{Worksheet}[$sheet]->{MinCol} > $col)); $current_book->{Worksheet}[$sheet]->{Name} = $book->{Worksheet}[$sheet]->{Name} if (!(defined($current_book->{Worksheet}[$sheet]->{Name}))); $current_book->{SheetCount} = ($sheet + 1) if (!(defined($current_book->{SheetCount})) or ($current_book->{SheetCount} < ($sheet + 1))); } my $excel_book = $excel_handle->Parse('test_1.xls'); $excel_book = $current_book;