Checking if a Value Exists in a Google Sheet (Binary Output)

How can I compare a single value against a set of values in a Google Sheet and get a binary output (1 or 0)?

Example:
I have a list of emails fetched from Sales Navigator stored in a Google Sheet. Each time my Slack node triggers, it provides an email. This email needs to be checked against the list in the Google Sheet column:

  • If the email exists in the list, return 1
  • If it doesn’t exist, return 0

Any help would be greatly appreciated!

Information on your n8n setup

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

Hello @Keerthi_Vasan

You can do this in several ways, for example:

  1. Function Node:
    Loop through the results from the Google Sheets node (using the “Get Rows” operation) to check if the incoming email exists. Then output 1 if it exists, or 0 if it does not.

  2. Google Sheets Node (Filter Tab):
    Use the Filter tab to set the email coming from Slack. This will output all rows that match the email, and you can then use a Set node to extract the data you need.

Hope this helps!


If this answers your question, please mark the reply as the solution :white_check_mark::pray:t2:

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