Using output of node 2 in node 5


Maybe a beginner question, sorry in advance.

In my workflow, I want to use an ‘output’ of node 2 in node 5 (where I also use ‘outputs’ of node 4).

I have tried with an ‘expression’ using the ‘variable selector’; but the json parameter related to node 2 appears in red (and the node does not execute).

The error message is:
“ERROR: Invalid expression under ‘Could not find parameter “undefined”’
The expression uses data in the node ‘GSheet: get rss’ but there is more than one matching item in that node”

Do you have recommendation?
Thanks in advance!

Information on your n8n setup

  • n8n version: 20
  • Database (default: SQLite): None
  • n8n EXECUTIONS_PROCESS setting (default: own, main): ?
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: W11

@AyS_0908 , strictly speaking, any previous node in the chain could be accessed as per Output of other nodes | n8n Docs. There are variations depending on the type of the previous node. For example, to access all the entries in Google Steet node (your 2nd node) you could use $('GSheet: get rss read').all().

You actually also can access the data from previous nodes from UI by selecting the node in question and picking the output you need (drag and drop). This would be done from OAI node and locating a previous node in the list of nodes on the left. For demonstration purposes only,

However, I suspect you need to do more than that depending on how you need to process the data from both previous nodes in OIA node. Judging by the image it looks like you need to combine the outputs of “GSheet: get rss read” and “GSheet: get rss read” somehow first as they have different number of items in their outputs.

Thus, while it is possible to access “GSheet: get rss read” from “OAl: category per feed” I have a strong feeling that it might not let you do what you want. If that is so, could you provide more details in what combination the data from both spreadsheets are to be used in “OAl: category per feed”? Depending on your answer we can think about the means of combining that data prior to feeding it into OAI node.


Thank you @ihortom for your answer.

I am trying to classify some articles by “Topics” thanks to GPT.

  • “Topics” are collected in a GSheet tab A (node 2),
  • Articles are collected from a GSHeet tab B (node 4),
  • GPT must classify in node 5.

The workflow

My current approach (which does not work)

If I understand properly your documentation link, what I may do is:

  • Move my column “Topics” in GSheet - Tab A to last column,
  • and use:
    $("<node-name>").last(branchIndex?, run Index?) = The last item output by the given node.

@AyS_0908 , if I understood you right, you need all the possible combinations of topics and articles and see how GPT classifies that. If so, you need to combine the outputs of the two spreadsheets first.

On the other hand, if your every article already has its dedicated topic (there is a segregation rather than a combination of all) I expect “Read rss1” node to provide you that. Therefore, instead of connecting OAI node to “GSheet: get feeds” you might want to have it linked to “Read rss1” (perhaps via Edit Fields node to prepare the topic and article in the right combination).

Without seeing the outcome of the nodes it’s hard to give a definite answer.


Thank you very much @ihortom ; I will try this !

1 Like

Hi @ihortom,
I had to change my above workflow, but I still have the same type of issues: combining some values of a node n-2 and n-1 for a node n.

Illustration: I would like to have the eMAIL values of node “Get Rss” included in the output of each row of “Read Rss”, and then in the “Group Rss feeds” (‘code’ node).

Overall workflow

node “Get Rss”

node “Read Rss”

**node “Group Rss feeds”

I read this Output of other nodes | n8n Docs, but I am not sure that it applies to my case, does it?

Thanks in advance

@AyS_0908 , to reference data produced by Group Rss feeds node in Gmail, you do not need to use $('<NODE>') unless you want to utilize the data from Get rss in there too.

In the letter case, I would still prefer engaging Merge node (to merge the data from Read Rss and Get rss) as it helps visualize the dependencies clearer. Though, it is a matter of taste.

Another tip. I see that you use $input.all().forEach and then referencing each property via parent json as in item.json.title. I prefer doing it like this:

const items = $input.all().map(i => i.json);

items.forEach(item => {

Then, you would reference title just as item.title, no json. It’s handy especially when you reference lots of properties in the function (saves typing).

1 Like

Hi @ihortom

Thanks again for your reply, and I’m sorry about these probably “basic” questions.

The overall use case is to send daily the Rss feeds of a given user into a single email.

  1. Input: a user enters its email address and its Rss urls (a, b, c)
    → node: “Get Rss”


  • For each ‘Rss url’, all feeds of all users are collected
    → node: ‘Read Rss’

  • Then, these collected feeds are concatenated per user email and date.
    → node: I tested the options of the ‘merge’ node, and it works to provide the concatenation: that’s a great beginning!

new workflow with ‘merge’

merge node output

:arrow_right: NOW, my challenge is to send to each user, 1 singe eMail, daily with its Feeds.
Example of output:

email A

  • Title A1
    . Content A1
    . Url A1
  • Title A2
    . Content A2
    . Url A2

email B

  • Title B1
    . Content B1
    . Url B1
  • Title B2
    . Content B2
    . Url B2

→ With the “item list” node, I don’t get (yet) the expected output

I keep testing…
Thanks again!

@AyS_0908 , thanks for more clarity on your goal. Now I can be more specific. We need to make a few changes. In particular, the “Multiplex” option does not suit here (sorry for sending you the wrong direction here). You need to merge by position instead.

Below is how you could group by email (node “Group by Email”) assuming you have property called “EMAIL” (as seen from your screenshot) - it becomes a key in the node “Email as Key”. You can further aggregate the data in a similar fashion if need to be. Hopefully you can see where I’m going and can finish it up yourself. If not, let me know.


Thank you very much @ihortom .

Thanks to your input (and some additional questions to our GPT friend), I finally came-up with the target working workflow: my first one on n8n!

I’m impatient to be able to help as you did!
Thanks again!

1 Like

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