Reputation: 349
I read openpyxl - Reading a next cell value in a loop. There was no appropriate answer.
I am searching an random cell.
In the case I get value from "AB1", my target is "AC1".
If it's "sheet.cell(row=1, column=1)", I can increment it like
sheet.cell(row=2, column=1)
However, its alphabet.
Any helps are appreciated.
Upvotes: 0
Views: 1047
Reputation: 349
I found the answer thanks to helps.
# colnum="AZ", rownum="9"
alink = sh[colnum+rownum].value
In this case,
# colnum="AZ", colint="52"
colint = openpyxl.utils.column_index_from_string(colnum)
nextcell = sh.cell(row=i, column=colint+1).value
Then, I could get next cell!
Upvotes: 1