Last active
December 3, 2018 05:01
-
-
Save ryonakae/02e1b83fc324758b598a6714b3b68079 to your computer and use it in GitHub Desktop.
node.jsでスプレッドシートのgidをworksheetidに変換
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
function gid_to_wid(gid) { | |
const xorval = gid > 31578 ? 474 : 31578 | |
const letter = gid > 31578 ? 'o' : '' | |
const wid = letter + parseInt((gid ^ xorval)).toString(36) | |
console.log('gid', gid) | |
console.log('xorval', xorval) | |
console.log('letter', letter) | |
console.log('worksheetid', wid) | |
} | |
gid_to_wid(process.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gidが
12345
だとして、すると、
のように表示される