I’ve downloaded a file from google drive and I want to rename the binary file using a field name but I can’t seem to get the output right. I want to later use it upload to another service. How can I fix this?
Hey @Ruriko
You’re very close the problem is just in the Code node.
Your Merge is correct
Using Merge → Combine → By Position is exactly how you combine the JSON from Edit Fields with the binary from Download file so that both json and binary are available in one item.
won’t interpolate json.title / json.number. Use the merged item and a template literal:
const item = $input.item;
// item.json now has title & number from Edit Fields
// item.binary.data comes from Google Drive "Download file" (default field name is "data") [[Download file](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googledrive/file-operations/#download-a-file)]
item.binary.data.fileName = `${item.json.title}_${item.json.number}.zip`;
return item;
Make sure the Code node is set to Run Once for Each Item (the default for Code v2).
Using it in the next upload node
When you upload to another service (for example Google Drive “Upload”):
Input Data Field Name should be data, because that’s the binary key containing your renamed file.
After this, the upload node will receive:
binary.data → file content + renamed fileName
json.title / json.number still available if needed.
So with this you should be able to rename that file, let me know if this helps