openpyxl - Reading a next cell value in a loop
问题 I am creating an loop to traverse the cells in sheet. At some conditions i want to access next cell value in a loop. import openpyxl wb = openpyxl.load_workbook('test.xlsx') wb = wb.get_sheet_by_name("Sheet 1") for row in wb['A1' : 'B150']: for cell in row: print cell.value # prints current active cell if something: # print next cell value Please suggest a way to access next cell value in a loop. I am using python 2.7. Thanks in advance. 回答1: Well, this is not an OpenPyXl specific question,