I am using the Spreadsheet::XLSX module to parse a sheet with some cells merged in column B across rows. I am using a for loop to get the value in column A and B for each row:
for my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
my $A_cell = $sheet->{Cells}[$row][$A_col];
my $B_cell = $sheet->{Cells}[$row][$B_col];
my $A_val = $A_cell->{Val};
my $B_val = $B_cell->{Val};
...
(I have already gotten the indices for $A_col and $B_col.) The cells in column A are never merged, and I need to get its corresponding value in column B.
===|===|
A1 |B1 |
===|===|
A2 |B2 |
===| |
A3 | |
===|===|
A4 |B4 |
===|===|
However, if it is a merged cell in B, then only the first row shows the value and not the subsequent ones of the cell. I tried storing the previous value and use that if it is merged by checking with the is_merged() function as shown in the Spreadsheet::ParseExcel module:
my $is_merged = $B_cell->is_merged();
I get the following error though:
"Can't call method "is_merged" on an undefined value"
Is the is_merged() function not in the XLSX version, or am I doing something wrong?
Thanks.