printf("( %s , %s ) => %s
", $row, $col, $cell -> {Val});
####
...
my $f_to_parse = "accounts.xlsx";
my $excel = Spreadsheet::XLSX->new($f_to_parse) or die "could not read the excel: $@$!";
foreach my $sheet (@{$excel -> {Worksheet}}) {
printf("Sheet: %s
", $sheet->{Name});
$sheet -> {MaxRow} ||= $sheet -> {MinRow};
# Skip worksheet if it doesn't contain data.
next if $sheet -> {MinRow} > $sheet -> {MaxRow};
foreach my $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) {
$sheet -> {MaxCol} ||= $sheet -> {MinCol};
foreach my $col ($sheet -> {MinCol} .. $sheet -> {MaxCol}) {
my $cell = $sheet -> {Cells} [$row] [$col];
if ($cell) {
printf("( %s , %s ) => %s
", $row, $col, $cell -> {Val});
my $name_header = $cell -> {Val} if $cell -> {Val} =~m/\bName\b$/i;
my $address_header = $cell -> {Val} if $cell -> {Val} =~m/\bAddress\b$/i;
#my $name_val = $sheet->{Cells}[$col][0]->{Val};
#my $address_val = $sheet->{Cells}[$row][0]->{Val};
print "\n\n Test Results:::174^^$name_val -> $address_val\n";
}
}
}
}