code: def _excel2num(x):
      
      index = 0
  
      for c in x.upper().strip():
          cp = ord(c)
  
          if cp < ord("A") or cp > ord("Z"):
              raise ValueError("Invalid column name: {x}".format(x=x))
  
          index = index * 26 + cp - ord("A") + 1
  
      return index - 1
docs: 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.