Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serious error: Row and column labeling is opposite #555

Open
dbooth-boston opened this issue Mar 21, 2021 · 1 comment
Open

Serious error: Row and column labeling is opposite #555

dbooth-boston opened this issue Mar 21, 2021 · 1 comment

Comments

@dbooth-boston
Copy link

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?

@poti1
Copy link

poti1 commented Oct 8, 2022

I created a PR for this:
#565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants