def col2num(col):
    num = 0
for c in col:
    if c in string.ascii_letters:
        num = num * 26 + (ord(c.upper()) - ord('A')) + 1
return num
Convert an excel or spreadsheet column letter to its number in Pythonic fashion