Created
December 30, 2019 22:40
-
-
Save shibukawa/078176fd15b9c89cd475e550f503bbab to your computer and use it in GitHub Desktop.
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 download() { | |
console.log("start downloading"); | |
const contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; | |
const wb = XLSX.utils.book_new(); | |
const ws = XLSX.utils.aoa_to_sheet([ | |
["みずほ銀行", "0001"], | |
["三菱UFJ銀行", "0005"], | |
["三井住友銀行", "0009"], | |
["りそな銀行", "0010"], | |
["埼玉りそな銀行", "0017"], | |
]); | |
XLSX.utils.book_append_sheet(wb, ws, "Bank Codes"); | |
const xlsx = XLSX.write(wb, { type: "array" }); | |
const a = document.createElement("a"); | |
const url = URL.createObjectURL(new Blob([xlsx], { | |
type: contentType | |
})); | |
a.href = url; | |
a.download = "bankcode.xlsx"; | |
a.click(); | |
URL.revokeObjectURL(url); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment