def _excel2num(x):
index = <NUM_LIT:0><EOL>for c in x.upper().strip():<EOL><INDENT>cp = ord(c)<EOL>if cp < ord("<STR_LIT:A>") or cp > ord("<STR_LIT>"):<EOL><INDENT>raise ValueError("<STR_LIT>".format(x=x))<EOL><DEDENT>index = index * <NUM_LIT> + cp - ord("<STR_LIT:A>") + <NUM_LIT:1><EOL><DEDENT>return index - <NUM_LIT:1><EOL>
Convert Excel column name like 'AB' to 0-based column index.

Parameters
----------
x : str
    The Excel column name to convert to a 0-based column index.

Returns
-------
num : int
    The column index corresponding to the name.

Raises
------
ValueError
    Part of the Excel column name was invalid.