Data Synchronization and Qualified Lead Filtering to Google Sheets - n8n Workflow

Sync qualified user data automatically from a PostgreSQL database to Google Sheets using this powerful n8n workflow. Includes filtering logic for lead qualification.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  1. Marketing operations professionals needing automated lead sync.

  2. Data engineers requiring real-time data transfer between systems using an n8n workflow.

  3. Users looking for effective n8n templates to implement crucial data filtering logic.

  4. Businesses needing to maintain qualified lead lists in Google Sheets.

Overview

This robust n8n workflow addresses the critical business need of automatically syncing qualified customer or user data from a primary system (like a PostgreSQL database) into a secondary management system (like Google Sheets). The workflow ensures data hygiene and qualification by applying a crucial Filter n8n node to exclude internal or invalid emails (specifically those containing “@n8n.io”). By utilizing this specific n8n workflow, organizations can streamline their sales efforts, immediately populating a 'Qualified Leads to Contact' sheet only with prospects who meet predefined criteria. This template showcases how to build scalable n8n automation, regardless of whether your source is a database or another application, making it one of the most useful n8n templates for ops teams.

How it Works

This powerful n8n automation is designed to start with an event-based n8n trigger. In a production environment, the process begins with the Postgres Trigger n8n node, configured to listen for UPDATE events on a designated users table. This acts as the official data synchronization n8n trigger. For easy setup and testing, the n8n workflow also includes a manual flow: the On clicking "Execute Node" n8n trigger connects to a Code n8n node that provides mock user data.

Regardless of the source, the data items proceed directly to the Filter n8n node. This is the lead qualification step, filtering out any records where the email address contains the substring “n8n.io”. Only qualified items that pass this criteria continue down the n8n workflow path.

Finally, the qualified data flows into the Google Sheets n8n node. This node is configured to use the appendOrUpdate operation, saving key fields like id, email, and username to the target spreadsheet. This comprehensive n8n workflow ensures a real-time, filtered flow of vital data to your marketing or sales tracking system.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON and import it directly into your n8n instance.

  2. Set up Credentials: You must configure credentials for the two main services.

Postgres: Create or link an existing Postgres credential (named 'Postgres Product Analytics' in the example) that has read access to your users table.
Google Sheets: Create or link a Google Sheets OAuth2 API credential. Ensure n8n has permission to write to the designated spreadsheet.

  1. Configure the Google Sheets n8n Node: Open the Google Sheets n8n node. Select your duplicated lead tracking spreadsheet and the specific sheet name (e.g., 'Sheet1'). Ensure the column mapping matches your sheet headers.

  2. Production Readiness: To use the database sync, enable the Postgres Trigger n8n node and ensure it is linked to the correct table name. Disable or remove the test path (On clicking "Execute Node" and Code n8n node) before activating the main n8n workflow.

Node Details

Postgres Trigger (n8n trigger):
Function: Serves as the real-time, production n8n trigger. It automatically starts the n8n workflow upon specific events in the database.
Key Configuration: Currently configured to fire on UPDATE operations on the users table.
On clicking "Execute Node" (n8n trigger):
Function: A manual trigger used exclusively for testing the internal logic of the n8n workflow without needing live database changes.
Code (n8n node):
Function: Provides mock JSON data for quick testing when the manual n8n trigger is used. It simulates a qualified user record.
Filter (n8n node):
Function: The primary qualification step. It controls the core logic flow, allowing only records that pass the specified condition to proceed.
Key Configuration: Condition checks if email does not contain 'n8n.io'.
Google Sheets (n8n node):
Function: The final action step, responsible for saving the filtered, qualified leads into the designated Google Sheet.
* Key Configuration: Operation set to Append Or Update. Maps input fields (id, email, username) to corresponding sheet columns.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
n8n Team
n8n Team

Meet the official n8n team. We specialize in building workflows that transform intricate tasks into seamless operations.

Featured*