Skip to content

Instantly share code, notes, and snippets.

@MakotoE
Last active April 11, 2019 00:40
Show Gist options
  • Save MakotoE/b91ddfc877dfd0d9e8015c578882f6ee to your computer and use it in GitHub Desktop.
Save MakotoE/b91ddfc877dfd0d9e8015c578882f6ee to your computer and use it in GitHub Desktop.
Performs a basic Excel API call using plain JavaScript & Promises.
name: FileSaver minimal test
description: Performs a basic Excel API call using plain JavaScript & Promises.
host: EXCEL
api_set: {}
script:
content: |-
const blob = new Blob(["test"], { type: "application/octet-stream" });
const reader = new FileReader();
reader.onloadend = function () {
const url = reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;');
location.href = url
}
reader.readAsDataURL(blob)
language: typescript
template:
content: ''
language: html
style:
content: ''
language: css
libraries: file-saver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment