def column_integer_to_index(idx):
    """Convert integer column index to XLS-style equivalent

    Given an integer index, converts it to the XLS-style
    equivalent e.g. 'A', 'BZ' etc, using a zero-based
    counting system (so zero is equivalent to 'A', 1 to 'B'
    etc).

    """
    # Convert integer column to index equivalent
    col = ''
    while idx >= 0:
        col += chr((idx%26)+65)
        idx = idx//26-1
    return col[::-1]