Apache POI, translating Excel column number to letter

Recently I had to write some code to generate excel files using Apache POI. One of the files was fairly complex and used formulas in a few cells.

I found myself spending a few hours searching for a way to translate the indexed column numbers that POI uses to the column letters I needed in those formulas.

It turns out the solution is quite simple, you just have to use org.apache.poi.hssf.util.CellReference:

String columnLetter = CellReference.convertNumToColString(columnNumber);