Say i have a cell in position (AZ, 5) in an excel spreadsheet and would like to convert the column reference AZ into a number such that A -> 1, .. , Z -> 26, AA -> 27, AZ -> 52. How can i do so.
My attempt doesn't seem optimal:
import string
di=dict(zip(string.ascii_uppercase,[ord(c)%32 for c in string.ascii_uppercase]))
def column_to_number(ref):
    if len(ref) == 1:
        number = di[ref]
    else:
        for i in ref:
            # don't know what to do here
    return number