0

Now I have tried to make csv file from Visual Studio Code. I found a code to make csv file from editor. However, the code is not working. Please give me advise to resolve a problem in the code.

*Win 10 pro 64 bit, VScode: 1.45.1, node.js: 13.14.0, clasp: 2.3.0

let blob = new Blob(['ABC'],{type:"text/csv"});
let link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'made from vscode.csv';
link.click();

I modified first sentence. text/plan to text/csv

dominic
  • 1
  • 4
  • What do you mean by **not working**? Can you please explain e.g. did you get any error message? Thanks! – norbitrial May 18 '20 at 12:39
  • First of all, this is not correct: `let blob = new Blob(['ABC'],{type:"text/plan"});`. It should be `text/csv`. – Lekoaf May 18 '20 at 12:41
  • Thank you for the reply. I have a error in debug console. The error is ReferenceError: Blob is not defined. – dominic May 18 '20 at 12:42
  • Thank you for additional comment. I modified the code but same error is continued. Please give me more advice. Thanks a lot. – dominic May 18 '20 at 12:48
  • The error doesn't seem to reproducible. It works fine for me... – Swetank Poddar May 18 '20 at 12:50
  • Check the answer of this post => https://stackoverflow.com/questions/53637644/how-do-i-create-a-blob-in-node-js I guess you are mixing up client side with server side javascript... this is why it doesn't work. You are doing it server side and probably some of you are testing it clientside. – Yak O'Poe May 18 '20 at 12:55
  • Thank you for the comment. I understood the root cause my issue. I should do clientside, right? How do I select it ? – dominic May 18 '20 at 13:07
  • I found first sentence in debug console of VSCode is written regarding to the node.js. C:\Program Files (x86)\Nodist\bin\node.exe ..\test.js How do I change I want to do the code clientside. – dominic May 18 '20 at 13:28
  • Please give me a hint how to get out of clasp's environment. – dominic May 19 '20 at 17:25
  • Error message is below. – dominic May 19 '20 at 17:37
  • "C:\Program Files (x86)\Nodist\bin\node.exe" --inspect-brk=16158 '"..\make csv file\test.js"' Debugger listening on ws://127.0.0.1:16158/da2f118f-a0f8-460a-b905-b997384180d2 For help, see: https://nodejs.org/en/docs/inspector Debugger attached. Waiting for the debugger to disconnect... ReferenceError: Blob is not defined – dominic May 19 '20 at 17:38
  • at Object. (c:\Users\name\make csv file\test.js:1:12) at Module._compile (internal/modules/cjs/loader.js:1115:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10) at Module.load (internal/modules/cjs/loader.js:982:32) at Function.Module._load (internal/modules/cjs/loader.js:875:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 – dominic May 19 '20 at 17:38

0 Answers0