python
def colnum(colname, _A2Z="ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
result = 0
for looc, colchar in enumerate(colname[::-1]):
point = _A2Z.index(colchar)
result += ((len(_A2Z) ** looc)) * point
return result
I wrote it because there was no function that returns the numerical value of the column in xlrd that handles Excel with python. If you look closely, it was useless because the corresponding function was included in xlwt. Since xlutils doesn't support python3 yet, You can't edit Excel with python3 using these.
Recommended Posts