Download a file from google drive and use in a http request

Describe the problem/error/question

I am trying to download a file from Google Drive and upload it into a http request. I have created credentials and the node works well. The problem is that I cannot access the actual file. The metadata comes in but no file data. There is nothing I can use for the upload http request.

What is the error message (if any)?

There is no error message, the node runs fine. I can also see the metadata about the file and the file size etc.

Please share your workflow

Share the output returned by the last node

[
{}
]

Information on your n8n setup

  • n8n version: cloud
  • Database (default: SQLite): no database
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
  • Operating system: Windows 11
1 Like

Hey @Karim_Lameer hope all is well. Two ways to send the file in http request node:

https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/#n8n-binary-file

https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/#form-data

3 Likes

@Karim_Lameer

Additionally, in the code node you can use this, to make it actually return the binary data:

// return first file
return ($("Download file").first().binary)

//return multiple files
return ($("Download file").all().map(x => x.binary))

@krisn0x thanks so much. I literally spent a day trying to figure this out. I knew it was something simple like this.

2 Likes

@Karim_Lameer I totally feel you :face_exhaling: . Anyways, glad we got it. Just a heads up: please mark either Jabbson’s or my reply as the solution, according to which helped you achieve the use case. Cheers!

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