def get_column_letter(col_idx):
 if (not (1 <= col_idx <= 18278)):
  msg = ('Column index out of bounds: %s' % col_idx)
  raise ColumnStringIndexException(msg)
 ordinals = []
 temp = col_idx
 while temp:
  (quotient, remainder) = divmod(temp, 26)
  if (remainder == 0):
   quotient -= 1
   remainder = 26
  ordinals.append((remainder + 64))
  temp = quotient
 ordinals.reverse()
 return ''.join([chr(ordinal) for ordinal in ordinals])

def get_column_letter ( col_idx ) : if ( not ( 1 <= col_idx <= 18278 ) ) : msg = ( 'Column index out of bounds: %s' % col_idx ) raise ColumnStringIndexException ( msg ) ordinals = [ ] temp = col_idx while temp : ( quotient , remainder ) = divmod ( temp , 26 ) if ( remainder == 0 ) : quotient -= 1 remainder = 26 ordinals . append ( ( remainder + 64 ) ) temp = quotient ordinals . reverse ( ) return '' . join ( [ chr ( ordinal ) for ordinal in ordinals ] )
convert a column index into a column letter .