Skip to content

Commit 68bfd59

Browse files
author
Luis M. Santos
committed
Bug fix for when worksheets are empty.
1 parent dfbe862 commit 68bfd59

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

O365/excel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,6 +1988,15 @@ def append_rows(self, rows):
19881988

19891989
# Find the last row index so we can grab a range after it.
19901990
current_range = self.get_used_range()
1991+
# Minor adjustment because Graph will return [['']] in an empty worksheet.
1992+
# Also, beware that Graph might report ghost values if testing using the front end site and that can be interesting
1993+
# during debugging. I ctrl + A and delete then click elsewhere before testing again.
1994+
# Might also take a moment for the backend to eventually catch up to the changes.
1995+
# Graph can be weirdly slow. It might be an institution thing.
1996+
if current_range.row_count == 1 and len(current_range.values[0]) == 1 and current_range.values[0][0] == '':
1997+
current_range.values = []
1998+
current_range.row_count = 0
1999+
19912000
target_index = current_range.row_count
19922001

19932002
# Generate the address needed to outline the bounding rectangle to use to fill in data.

0 commit comments

Comments
 (0)