Skip to content

Instantly share code, notes, and snippets.

@shibukawa
Created December 30, 2019 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shibukawa/078176fd15b9c89cd475e550f503bbab to your computer and use it in GitHub Desktop.
Save shibukawa/078176fd15b9c89cd475e550f503bbab to your computer and use it in GitHub Desktop.
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