Determine if worksheet is empty in openpyxl

后端 未结 1 1254
予麋鹿
予麋鹿 2021-01-16 01:32

I have an application where I write to a worksheet to the last column + 2 if there is already data and to the last column + 1 if the worksheet is empty. I get what I think i

相关标签:
1条回答
  • 2021-01-16 02:08

    The only reliable way to determine if a worksheet is "empty" is to look at the _cells attribute. However, this is part of the internal API and liable to change. In fact it is almost certain to change.

    The max_row and max_column attributes are used internally for counters and must be 1 or more.

    A feature request without relevant code and tests would be rejected and I'm fairly sceptical about the idea of "empty" worksheet in general.

    0 讨论(0)
提交回复
热议问题