row_dimensions[0] in xlsx creates worksheet with invalid row

Issue #676 resolved
Jacob C created an issue

Using openpyxl 2.3.5 It's possible to set

whateverworksheet.row_dimensions[0].height = 100 

for example in openpyxl. This creates an invalid row (row 0) in the raw excel xml file and causes errors/issues with other tools. An example of the impact would be if a user attempted to use xlrd/pandas to manipulate the data further,

  File "****\Python35\site-packages\xlrd\", line 630, in do_row
    assert 0 <= self.rowx < X12_MAX_ROWS

I'm very new to python, so its possible i'm the only person that made this particular mistake. Does this count as a bug?

Comments (4)

  1. CharlieC

    Well, we don't have an explicit check for this kind of thing but it does also look like user error to me: row 0 makes no sense within the spreadsheet context and it has never come up before. You can also create a columnDimension called "Spam", but this will at least raise an exception when saving the file.

    I'll add some checks for this but we do expect the code the library to be used by "consenting adults", ie. not total idiots. ;-)

  2. Jacob C reporter

    Thanks Charlie. I appreciate your efforts - even if the comments are always seriously demoralizing

  3. Log in to comment