Problem Filtering New RSS Items with Code Node and Google Sheets Input (Multiple Inputs)

Hi all,
I’m a new user of n8n, and i’m trying to build a workflow where I collect daily news from multiple RSS feeds and want to filter out the items that have already been sent in the past (links stored in a Google Sheet).
My goal is to only send new items (i.e., not already present in the Google Sheet).

Workflow structure (simplified):

  • Many RSS feeds merged together (Merge node, mode: Append)
  • Google Sheets node (Get Rows) which returns all previous links
  • Both branches (merged RSS items + Google Sheets) go into a Code node (JavaScript)
  • In the Code node, I want to filter out any RSS items whose link is already in the sheet

My issue:
No matter what I try, the Code node always returns no output (“No output data returned”) or seems to not filter correctly.
I believe the problem is with how I’m handling multiple inputs in the Code node, or perhaps the order/structure of the data.
I tried multiple different versions of code from various LLMs, but the node always seems to return no output.

Here is a version of the code i have tried:
js
const allInputs = $input.all();

// (In this example, let’s assume allInputs[0] = new RSS items, allInputs[1] = Google Sheet)
// If order is reversed, tried the opposite as well

const newArticlesInput = allInputs[0];
const googleSheetInput = allInputs[1];

// Get all links from Google Sheet (may be empty)
const oldLinks = googleSheetInput && googleSheetInput.items
? googleSheetInput.items.map(i => i.json.link)
: ;

// Get all new RSS items
const newItems = newArticlesInput && newArticlesInput.items
? newArticlesInput.items.map(i => i.json)
: ;

// Filter out those that are already in the sheet
const filtered = newItems.filter(item => !oldLinks.includes(item.link));

// Return new (not already sent) items
return filtered.map(i => ({ json: i }));

What I have tried:

  • Swapping the order of the inputs (using [0]/[1] and [1]/[0] for newArticlesInput and googleSheetInput)
  • Printing (console.log) allInputs to see their contents (but output is limited)
  • Testing with only one RSS feed + Google Sheets, or many

Question:

  • Is there a recommended way to reliably handle multiple inputs in a Code node and distinguish which is which?
  • Is there a best practice to ensure the Code node gets data from both RSS and Google Sheets in a predictable way?
  • Am I missing something obvious in my code or input handling?
  • How can I debug this further?

Any advice, examples, or corrections would be much appreciated! Thank you!





I see this, I immediately want to jump in and start investigating :smile:

In all seriousness, could you please provide a very simplified example of the issue (aka minimal reproducible example), so that we could concentrate on the issue instead of understanding all the interconnections of your workflow. Also when sharing please embed your workflows instead of sharing screenshots.

Hi @Jabbson,

Thank you so much for your fast reply and your interest in helping! :blush:

You’re right, my original workflow screenshot was a bit overwhelming. Following your advice, I’m working on creating a minimal reproducible example of the issue, with only the relevant nodes (a couple of RSS feeds, Google Sheets, and the Code node for filtering).

Just to clarify:

  • My goal is to filter out RSS items whose link is already present in a Google Sheet (i.e., only output “new” articles).
  • The Code node should receive two inputs:
    1. The new RSS items
    2. The list of existing links from the Google Sheet

If there are any best practices for formatting the sample workflow, please let me know and I’ll make sure to follow them.
Thanks again for your patience

Best,
Marios

Here we go:

On the sheet I have:

The outputs are merged together on the field link and non-matching are output.
The output of the Merge node is a list of links from RSS. which are not present on the sheet already.

Hope this is what you were looking for.

1 Like

I also threw in a remove duplicates into the mix, but there weren’t any. If you do not expect there will be, feel free to remove that node.

Thank you so much for your help and the detailed explanation!
Your suggestion was exactly what I needed.
Really appreciate the time you took to guide me through this!

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