Skip to content

Instantly share code, notes, and snippets.

@jonvuri
Created July 25, 2012 15:53
Show Gist options
  • Save jonvuri/3176910 to your computer and use it in GitHub Desktop.
Save jonvuri/3176910 to your computer and use it in GitHub Desktop.
function spreadsheetHeaderArray(length) {
var i, result = [], characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
for (i = 0; i < length; i += 1) {
result[i] = (i > 25) ? result[i - 26] + characters[i % 26] : characters[i % 26];
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment