表格列名转序号
// 'AM' => '39'
function codeToNum(code) {
const arr = code.toLowerCase().split('')
let num = 0
for (var i = 0; i < arr.length; i++) {
num += (arr[i].charCodeAt(0) - 96) * Math.pow(26, arr.length - i - 1)
}
return num
}
// '39' => 'AM'
function numToCode(num) {
const arr = []
const recurse = nnum => {
var num = nnum - 1
var a = parseInt(num / 26)
var b = num % 26
arr.push(String.fromCharCode(64 + parseInt(b + 1)))
if (a > 0) {
recurse(a)
}
}
recurse(num)
return arr.reverse().join('')
}