Multiple Binaries! Downloading Files in n8n
I've struggled with this many times now but this one seemed to work. n8n does not play well with multiple downloaded files at the same time, it tends to only want to you one, and only use it right after it's been downloaded. But I finally ran into a script that seemed to work for using multiple downloaded files at the same time. I needed to attach multiple documents to an email, and this code node managed to set it up before the Gmail node and after the download: let binaries = {}, binary_keys = []; for (const [index, inputItem] of Object.entries($input.all())) { binaries[`data_${index}`] = inputItem.binary.data; binary_keys.push(`data_${index}`); } return [{ json: { binary_keys: binary_keys.join(',') }, binary: binaries }]; Running that in a code node after the download allows for a drag and drop of the files that need to be attached in an email. Let me know if you need an example workflow for it!