How to put and IF with a Googe Sheets filter?

Google Sheets Filter Returns Nothing When Email Not Found - Can’t Route in IF Node

Problem

I have a Google Sheets node where I’m filtering data by email. Here’s what’s happening:

  • When the email exists: The filter returns data correctly
  • When the email does NOT exist: The filter returns nothing (empty array or undefined, i am not sure)
  • What I need: I need to use an IF node to route the workflow based on whether the email exists or not

What I’ve Tried

The problem is that when the filter returns no results, I can’t properly evaluate in the IF node whether the email is present or not.

What I Need

I need a way to:

  1. Detect when the Google Sheets filter returns empty results
  2. Route the flow to different paths depending on whether the email was found or not
  3. Handle both cases (email found / email not found) reliably

Has Anyone Solved a Similar Case?

I appreciate any suggestions on:

  • How to check if the filter result in Google sheets is empty
  • Expressions or conditions that work in the IF node
  • Alternative approaches to handle this

Hey @Ricardo_Robledo

What you have to do is go to the Google Sheets’ settings and enable “Always output data” option. This will make it produce an empty object instead of no result. This way in the if node you can check if the {{ $json }} object is empty.

2 Likes

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