Explore via Javascript HTTP request result

Hi all,
Do you have any idea of how to explore the http request output with javascript.
Currently, i have an output table or json.

Thanks a lot

Hi @herrT15

Sorry I do not understand completely what you mean.
If you have data inside n8n and want to use javascript you can use the code node to do any javascript you like.

Yes I have the data but my javascript function is implemented in a HTML code.
So I need to find the way to collect the the output of a spreadsheet in my javascript function

After that, I know how to download it…
Just one part is missing in order to finish my project…

You can use the Spreadsheet File node to access the data and use it in the flow. Then you can use a Code-Node to do with the help of JavaScript whatever you want.

Unrelated to your question but important:
Seems like you did not swich the “File Name” Parameter to expression for that reason is the name literally {{ $execution.id}}.xls

Do you have a javascript example?

About what to do in the Code-Node?

The best place for that would be our docs:

And many community forum posts.

1 Like

Thanks for the help.
Seems like these two lines are KO but I cannot figured out why…
data2 = $node.Spreadsheet1.binary.data;
let csv =await this.helpers.getBinaryDataBuffer(0, ‘data2’);

I would like to get the content of the binary which is in Spreadsheet1output.

The error is exactly what it says, you need to return items in the code node.
Please check some examples on the forum and in the docs.

Also not sure what you are trying to accomplish calling that function, no idea if you can actually do this in the code node.

If you want to convert the xls to csv. Then read the binary data and store with the spreadsheet node.


i just would like to be able to download a xls file from an html form with a javascript function :slight_smile: quite easy as the file is already avalaible in Spreadsheetfile but since yesterday i cannot figure out why it doesnt work… :frowning: i need some rest, i spent a night on it…it driving me crazy lol shame on me

Sorry I do not understand what you need the JavaScript for. What do you want to do with the file?
You already have the file, so what you want to do with it next? Covert? Send? Upload? Push data to an API?

I would like to download that file from the webhook url and and on n8n workflow.

Let’s resume (it will help me also)

  1. I create webhook GET URL
  2. From that URL, users can fill a form
  3. When submit POST URL, a lot of process is done, api etc
  4. results are in json are on the output of httprequest
  5. results in binary are on the output spreadsheetfile after httprequest
  6. A part of the result is shown on submit form
  7. in that submit form build in HTML there is a button download with a javascript function
  8. When click on that button it is supposed to download the full xls file to the user computer. but it failed

All other things are working fine

Fun fact is that the function i am trying to build is there on n8n…:

I would like exactly the same but in my html page with my button

If all you want is that the webhook call returns the data, all you have to do is to configure it accordingly:

That will make sure that if the webhook URL gets called it returns the binary data.

1 Like

It works!
I had to change my workflow process but the solution is fine.
Thank you ALL!!

Great to hear that it worked. Have fun!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.