Skip to content

Instantly share code, notes, and snippets.

@aonrobot
Created February 27, 2018 09:37
Show Gist options
  • Save aonrobot/964f1bda5f5f89c616156866107a03d6 to your computer and use it in GitHub Desktop.
Save aonrobot/964f1bda5f5f89c616156866107a03d6 to your computer and use it in GitHub Desktop.
function exportXLSX(blob){
if (typeof window.navigator.msSaveBlob === 'function') {
window.navigator.msSaveBlob(blob, "export-" + new Date().getTime() + ".xlsx");
} else {
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "export-" + new Date().getTime() + ".xlsx";
document.body.appendChild(link);
link.click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment