Created
September 9, 2022 08:09
-
-
Save dmitry-tuzenkov/3b72fcfdb3e88e42d97e23ba7978fb88 to your computer and use it in GitHub Desktop.
Number to XLSX Column Converter
This file contains hidden or 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
const APLHA_MOD = 26; | |
const nt = (n = 0) => ((n % APLHA_MOD) + 10).toString(APLHA_MOD + 10); | |
const ct = (n = 0, acc = "") => { | |
if (n - APLHA_MOD > 0) { | |
return ct(n - APLHA_MOD, acc + nt(APLHA_MOD)); | |
} | |
return acc + nt(n); | |
}; | |
// 1 = A, 2 = B, 26 = Z, 27 = AA, 28 = AB, 52 = AZ | |
console.clear(); | |
console.log( | |
Array(72) | |
.fill(0) | |
.map((x, i) => ct(i)) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment