use strict; use diagnostics; use warnings; use Spreadsheet::ParseXLSX; my %data; #initializing hash my $logfile = $ARGV[0]; #Take the file from command line my $parser = Spreadsheet::ParseXLSX->new(); #Initialize Parser my $workbook = $parser->parse($logfile); #Assign the .xlsx file to be parsed if ( !defined $workbook ) { die $parser->error(), ".\n"; #Kill parser if .xlsx file not present } for my $worksheet ( $workbook->worksheets() ) { #Loop till end of worksheet my ( $row_min, $row_max ) = $worksheet->row_range(); #Getting max and min row my ( $col_min, $col_max ) = $worksheet->col_range(); #Getting max and min col for my $row ( $row_min .. $row_max ) { #Loop till max row in a sheet for my $col ( $col_min .. $col_max ) { #Loop till max col in a sheet #Adding Hash Elements from Excel my $name_add = $worksheet->get_cell( $row, $col+2 ); next unless $name_add; my $cell_add = $worksheet->get_cell( $row, $col+3 ); next unless $cell_add; my $name = $field_name_add->value(); my $val = $cell_add->value(); $data{$name} = $val ; } } } #=======================================Reading_Formula_File======================================= my $formulae = $ARGV[1]; open ( RD, $formulae ) or die "Couldnt open file $formulae, $!"; while ( $_ = ){ eval $_; printf("%s",$z); }