col_idx does not exist as a property of ReadOnlyCell

Issue #969 wontfix
James King created an issue

Hi!

I was writing some code and noticed that col_idx does NOT exist as a property of ReadOnlyCell, but it does for normal Cell instances. I wrote a workaround:

getattr(cell, "col_idx", cell.column)

But, obviously, it would be preferable to just be able to retrieve col_idx.

Furthermore, cell.column in ReadOnlyCell is a number, whereas in normal Cell instances is a letter.

I may try to submit a patch later, but I wanted to have this logged in the meanwhile.

I didn't try this in the latest version of openpyxl, but looking at the source in master it seems to have not been addressed yet.

Comments (3)

  1. James King reporter

    This should probably be a separate issue, but also read_only.EmptyCell is missing those properties completely.

  2. CharlieC

    In this case ReadOnlyCell's have the future API. In a read-only context I'd tend to use enumerate anyway.
    EmptyCell is a singleton and is just there to keep selections of predictable width. You're probably doing something wrong if you're checking for anything other than None.

  3. Log in to comment