From 79fd9f2060cf6120abad8f1a29ba3f4ac61ebdef Mon Sep 17 00:00:00 2001 From: ditenberg Date: Sun, 30 Oct 2016 02:14:27 -0400 Subject: [PATCH] COMPAT: openpyxl #14519 Updated _Openpyxl22Writer.write_cells() to use new coordinate call method wks['coordinate'] instead of wks.cell() in accordance with https://openpyxl.readthedocs.io/en/default/tutorial.html#accessing-one-cell in the newest release of Openpyxl (2.4.0 and later). --- pandas/io/excel.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pandas/io/excel.py b/pandas/io/excel.py index 6662d106ad85d..3814622f4b525 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -1308,10 +1308,8 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0): self.sheets[sheet_name] = wks for cell in cells: - xcell = wks.cell( - row=startrow + cell.row + 1, - column=startcol + cell.col + 1 - ) + xcell = wks['%s%s' % + (startrow + cell.row + 1, startcol + cell.col + 1)] xcell.value = _conv_value(cell.val) style_kwargs = {} @@ -1349,7 +1347,7 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0): if row == first_row and col == first_col: # Ignore first cell. It is already handled. continue - xcell = wks.cell(column=col, row=row) + xcell = wks['%s%s' % (col, row)] for k, v in style_kwargs.items(): setattr(xcell, k, v)