Google Drive Parent Expression Only Activating on First Binary

Hello! I am using this Google Drive Backup Workflow from Djangelic and I’m trying to insert a function that allows me to save each backup to a folder named todays date but I’m having some issues with the upload.

  1. Pulls HTML of information about all of my workflows (name, ID, tags, etc)
  2. Maps the HTML to JSON
  3. Pulls restoration data content for each workflow based on the id[] from step 1
  4. Merges step 1 and 3 so the array contains a copy of the resoration file
  5. Converts the array back into restoration-data-only
  6. Converts the restoration array into a .json binary
  7. Uploads thos badboys to my gdrive at the folder ID indicated. I indicate the file by setting the variable parents[]

Steps 1-7 work perfectly. IF I always upload to the same folder. But I wanted to create a new folder named todays date and upload all of the files there. So I added these three troublemakers.

  1. Gets the date and formats it the way I want date[]
  2. creates a folder named date[] and gives it an id[]
  3. Renames id[] to parents[] and discards all other variables. (I put this right at the beginning of the flow so no other variables get deleted.)

This is where I don’t really understand what’s happening. As soon as I add these three steps and set Google Drive to use an expression to use the id of the newly created folder it will only work for the first binary and the other three will be saved to root (I have 4 workflows right now).

I’m sorry if I’m not explaining this perfectly, I’m very new to N8N and I’m confused about how expressions work when you type in the box vs clicking “add expression”.

Welcome to the community @avasond

In the Drive Upload node use the following expression: $item(0).$node["Drive Create"]["id"] instead of $node["Drive Create"]["id"] which is what you are probably doing.

I’m confused about how expressions work when you type in the box vs clicking “add expression”.

It’s only an expression when you click on “add expression”. An expression reference data from other nodes.

You can find information about how $items works in the links below.

1 Like

That worked! Thank you so much, I wasn’t sure how to search for the issue. I was actually using the Set node because I was having issues with multiple nodes using the name property so I discarded it at the beginning.
The following solved the problem - thank you again!

{{$item(0).$node[“Set”].json[“parents”]}}

2 Likes