I have a spreadsheet of data I am parsing using openpyxl’s iter_rows function. However when I loop through the sheet using:
range_expr = "{col}{startrow}:{col}{endrow}".format(col='C',startrow=4,endrow=ws.get_highest_row()+1)
for row in ws.iter_rows(range_string=range_expr):
print row
if len(row) > 0:
cell = row[0]
if str(cell.value).isdigit():
address.append(cell.value)
else:
continue
print address
raw_input("enter to continue")
the 3rd line just spews out empty parenthesis, which means the first if statement will always evaluate false, and no values will append to address. What I’m confused about is why print row does nothing, when there is data in the excel document. Thanks in advance everyone.
I was overcomplicating things, and simplified it to this. Many thanks to notbad.jpg on the Python chat room: