2016-06-10 24 views

回答

1

最簡單的解決辦法是安裝具有min_col,min_row,max_col,MAX_ROW參數ws.iter_rows()的openpyxl 2.4公測:

for row in ws.iter_rows(min_row=3, min_col=5, max_col=bc_col): 
    for cell in row: 
     # do something with cell 

否則你應該使用字符串格式化來創建範圍:

cell_range = "E3:{0}28".format(get_column_letter(bc_col))

+0

查理C,你的「否則」解決方案爲我工作。非常感謝你。哪裏是最好的地方,以獲得openpyxl 2.4?,豐富 –

+0

'pip安裝-U --pre openpyxl' –

相關問題