Skip to content

Instantly share code, notes, and snippets.

@black-black-cat
Created December 27, 2017 03:30
Show Gist options
  • Save black-black-cat/0d30af892747ec5ab879b3247a73368b to your computer and use it in GitHub Desktop.
Save black-black-cat/0d30af892747ec5ab879b3247a73368b to your computer and use it in GitHub Desktop.
将数字转换成Excel列数
function toColStr(n) {
str = ''
while (n > 0) {
var mod = (n-1) % 26
n = Math.floor( (n-1)/26 )
str = String.fromCharCode( mod + 65 ) + str
}
return str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment