Need help with n8n workflow: Google Sheets lookup with filters returns 0 items for non-existent records, but the IF node isn’t routing to the FALSE branch. How do I make it continue to ‘new contact’ flow when no match is found?"
Describe the problem/error/question
Need help with n8n workflow: Google Sheets lookup with filters returns 0 items for non-existent records, but the IF node isn’t routing to the FALSE branch. How do I make it continue to ‘new contact’ flow when no match is found?"
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version: comunity
- Database (default: SQLite): yes default
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
In your case::
- Enable “Always output data” only on the Google Sheets node, not on the IF node.
- In the IF node, just test if
{{ $json }} “is empty” to decide between “contact exists” and “new contact.”
This way you avoid the issues mentioned above and can still proceed to the “new contact” flow when there’s no match.
Give that a try and let me know how it goes! 
Hi @Ing_Diego_Bustos Welcome!
Just enable “Always Output Data” and configure your IF node to check if {{ $json }} (Is Empty) to correctly route empty results to your new contact flow.
aa
If in the Google Sheets “Search” node I need its output to return the Telegram ID number in order to indicate that it exists, and then in the IF node I want to use that ID as input to determine whether it exists in the sheet, but in the output I get “No fields – item(s) exist, but they’re empty”, I think this is where the problem is, and that’s why it always goes down the new contact branch.
@Ing_Diego_Bustos
When Google Sheets → Search doesn’t find any records and “Always Output Data” is enabled, n8n returns an empty item, not zero items. That’s why the IF node shows “No fields – item(s) exist, but they’re empty” and any test based on the Telegram ID fails, making the flow always fall into “new contact.”
solution
- Keep “Always Output Data = ON” in Google Sheets → Search
- In the IF node, don’t test fields; just test:
Value 1: {{ $json }}
Operation: Is Empty
- TRUE → empty item → New contact
4.FALSE* → item with data → Contact exists (use the Telegram ID only after the IF)
Hope this work!
@Ing_Diego_Bustos To fix this, keep ‘Always Output Data’ enabled on the Search node, but in the IF node just test if {{ $json }} is empty to decide:
If you need the Telegram ID when it exists, you can still read it from the same item on the TRUE branch; on the FALSE branch you’ll just work with an empty item and create the new contact.