You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your article on reading Excel from perl! But there is a serious error, regarding rows and columns, that is causing much confusion among readers. You wrote: "The next snippet will read the first row of the first sheet (which is usually represented by the letter A)". But spreadsheets do not use letters to represent rows. The COLUMNS are represented as letters, and the rows are represented as NUMBERS. Consequently, the output is incorrectly labeled in the snippet of code that you show for displaying the content of a row. The corrected code should be:
my @row = Spreadsheet::Read::row($book->[1], 1);
for my $i (0 .. $#row) {
say chr(ord('A')+$i) . '1 ' . ($row[$i] // '');
}
And the output is similarly incorrectly labeled in the snippet of code for fetching all the rows. That corrected code should be:
my @rows = Spreadsheet::Read::rows($book->[1]);
foreach my $i (1 .. scalar @rows) {
foreach my $j (1 .. scalar @{$rows[$i-1]}) {
say chr(ord('A')+$j-1) . " $i " . ($rows[$i-1][$j-1] // '');
}
Would you be willing to make these corrections in your article?
The text was updated successfully, but these errors were encountered:
poti1
pushed a commit
to poti1/perlmaven.com
that referenced
this issue
Oct 8, 2022
Thanks for your article on reading Excel from perl! But there is a serious error, regarding rows and columns, that is causing much confusion among readers. You wrote: "The next snippet will read the first row of the first sheet (which is usually represented by the letter A)". But spreadsheets do not use letters to represent rows. The COLUMNS are represented as letters, and the rows are represented as NUMBERS. Consequently, the output is incorrectly labeled in the snippet of code that you show for displaying the content of a row. The corrected code should be:
And the output is similarly incorrectly labeled in the snippet of code for fetching all the rows. That corrected code should be:
Would you be willing to make these corrections in your article?
The text was updated successfully, but these errors were encountered: