my @name; my @details = (); for my $row(0 ..$row_max) { my $ligand_details = {}; for my $col (@required_cols) { warn Dumper($worksheet); my $cell = $worksheet->get_cell($row,$col); warn $cell; my $value = $cell ? $cell->val :''; if($row == 0 ) { $name[$col] = $value; } else { $ligand_details->{$name[$col]} = $value; } } push @details , $ligand_details if (defined $row); } return \@details;