Created
October 26, 2012 15:51
-
-
Save tansaku/3959565 to your computer and use it in GitHub Desktop.
convert integer to spreadsheet column name, a, b, c, ... aa, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colName(n) { | |
var s = ""; | |
while(n >= 0) { | |
s = String.fromCharCode(n % 26 + 97) + s; | |
n = Math.floor(n / 26) - 1; | |
} | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment