Block: Load folders from Google Drive
Input: 1 item, folder id
Output: 2 items
Block: Load files from Google Drive
Input: 2 items, folder id loaded previously
Output: 3 items (from different folders)
Problem: The output items do not contain ids of the respective folders.
Attempt 1: Use “Edit Fields” with “{{ $(‘List Folders’).item.json.name }}”.
Problem: Context connection between the input and output items is lost. Error message: “An expression here won’t work because it uses .item and n8n can’t figure out the matching item. This is because the node ‘Google Drive’ returned incorrect matching information (for item 0 of run 0).”
Attempt 2: Find a checkbox “pass inputs as outputs” in a “Google Drive search” node.
Problem: No such feature.
Challenge
Any ideas, how to inject a folder id into a file item?
Welcome to the community! You’re able to get this by adding all fields on that second file search and get the parents that references the folder where a file is at:
Thanks, but in multi-user envs, there are often appear multiple parents per single file in GDrive (thus, the parents field is an array), so this would require some heuristics algorithm to identify the relevant one.
Additionally, I’m looking for a direct way to match a piece of data from the preceding steps. In the real case, it was parent and some other fields too (what I’ve shared is the reduced case.)