Google Sheets Deduplication and Automated Data Cleanup - n8n Workflow

Automate data cleansing using this n8n workflow. Remove duplicate rows in Google Sheets based on specific identifiers (like profile URLs) and securely overwrite the sheet automatically.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Marketing analysts and data managers needing to maintain clean datasets.
Sales operations teams dealing with lead list imports and ensuring unique entries.
Users seeking reliable, automated data hygiene solutions using n8n templates.
Anyone managing large Google Sheets who wants to use the specialized 'Remove Duplicates' n8n node.

Overview

Maintaining clean data is crucial, but manual spreadsheet cleanup is time-consuming and error-prone. This specialized n8n workflow solves the common problem of duplicate entries in Google Sheets. By leveraging core n8n logic nodes, it automatically extracts all sheet data, processes it to remove redundant rows based on a unique identifier (like a profile URL), and then uses Google Drive functionality to overwrite the original sheet with the cleaned data.

This robust n8n automation ensures data integrity with minimal effort. It is an excellent example of how specific n8n templates can be configured to manage backend data operations efficiently.

How it Works

This n8n workflow operates in five sequential steps designed for maximum efficiency:


  1. Trigger the Flow: The process begins with a manual n8n trigger, ideal for testing or when you need to run an immediate, one-off cleanup operation.

  2. Retrieve Data: The Google Sheets n8n node connects to the specified document and sheet ('Digital Marketing Agencies' / 'With Email/Unused') and pulls all existing row data into the n8n environment as JSON items.

  3. Deduplication: The critical 'Remove Duplicates' n8n node processes the incoming data. It is configured to compare entries based specifically on the profileUrl field, ensuring that only unique records identified by that URL proceed to the next stage.

  4. Prepare for Overwrite: The resulting clean data is then passed to the 'Convert to File' n8n node. This step packages the deduplicated JSON items into a file format (typically CSV or XLSX) suitable for re-uploading.

  5. Update Google Sheet: Finally, the Google Drive n8n node performs an update operation. It targets the original Google Sheet file ID and overwrites the entire file content with the newly created, deduplicated file, completing the data cleanup process within this n8n workflow.

Installation Guide

To deploy this powerful n8n workflow, follow these setup steps:


  1. Import: Copy the provided n8n workflow JSON code and paste it into your n8n instance's canvas.

  2. Credentials: You must configure two sets of credentials:

Google Sheets OAuth2 API: Set up credentials for the 'Get row(s) in sheet' n8n node, granting access to read data from your spreadsheet.
Google Drive OAuth2 API: Set up separate credentials for the 'Update file' n8n node, ensuring permissions are granted to modify/overwrite the target spreadsheet file.

  1. Configuration (Google Sheets): Open the 'Get row(s) in sheet' n8n node and verify that the correct 'Document ID' and 'Sheet Name' are selected, matching the sheet you intend to clean.

  2. Configuration (Remove Duplicates): Confirm that the 'Remove Duplicates' n8n node is configured to compare the correct unique identifier field (e.g., profileUrl). If your unique field has a different header, update the field name accordingly.

  3. Execution: After configuration, execute the n8n workflow manually using the initial n8n trigger to test the data cleansing process.

Node Details

When clicking ‘Execute workflow’ (Manual Trigger): This n8n trigger starts the process manually, primarily used for immediate execution or testing the n8n workflow logic.
Get row(s) in sheet (Google Sheets n8n node): Function: Reads all rows from the specified spreadsheet ('Digital Marketing Agencies' - 'With Email/Unused'). Key Configuration: Uses OAuth2 credentials to securely access the data.
Remove Duplicates (Core n8n node): Function: Essential data hygiene step. It analyzes all input items and filters out duplicates. Key Configuration: Set to compare data based on the specific field profileUrl, ensuring that the deduplication is accurate.
Convert to File (Core n8n node): Function: Takes the cleaned JSON data set from the previous n8n node and converts it into a single file object, necessary for uploading/overwriting the Google Sheet.


  • Update file (Google Drive n8n node): Function: Overwrites the original Google Sheet file using the content provided by the 'Convert to File' n8n node. Key Configuration: Operation set to update and changeFileContent is enabled, targeting the Sheet's Document ID as the File ID.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
Paul Kobelke
Paul Kobelke

Featured*