---
# System prepended metadata

title: 0168. Excel Sheet Column Title
tags: [Leetcode, Easy]

---

# 0168. Excel Sheet Column Title
###### tags: `Leetcode` `Easy`
Link: https://leetcode.com/problems/excel-sheet-column-title/description/
## 思路
相当于一个26进位的数字转换
columnNumber每次都需要-1 这样A才对应0, Z对应25
## Code
```python=
class Solution:
    def convertToTitle(self, columnNumber: int) -> str:
        s = ""
        while columnNumber != 0:
            s += chr((columnNumber-1)%26 + ord('A'))
            columnNumber = (columnNumber-1)//26
        return s[::-1]
```