n8n

How to Automate Google Sheets List Cleanup?

Turn messy CSV exports into one clean subscriber list in Google Sheets. Great for marketing teams that collect signups from events, forms, and tools and need one trusted list for email campaigns.

The flow runs when you click Execute. It reads every CSV file from a folder and handles them one by one. Each file is parsed with header rows kept as text. Records are cleaned by removing duplicate user_name values, keeping only rows where subscribed equals TRUE, and sorting by date_subscribed. A Source field is added with the file name so you always know where each row came from. Clean data is then appended or updated in your Google Sheets tab.

You only need a Google account and a sheet with columns that match your CSV headers. Expect big time savings by cutting manual sorting and deduping from hours to minutes while improving accuracy. This setup works well for event exports, newsletter signups, and imports from legacy tools. Run it on demand to refresh your master list before every campaign.

What are the key features?

  • Manual run control so you can process files when you are ready
  • Reads all CSV files from a defined folder path in one click
  • Processes one file at a time using a batch size of one for stability
  • Parses CSV with header row and raw string handling to keep values consistent
  • Removes duplicate records by matching the user_name field
  • Keeps only records where subscribed equals TRUE for a clean list
  • Sorts rows by date_subscribed to keep the newest signups first
  • Adds a Source field with the file name for easy tracking
  • Appends or updates rows in Google Sheets based on your selected columns

What are the benefits?

  • Reduce manual list cleanup from 2 hours to 5 minutes
  • Improve data quality by removing 100 percent of exact duplicates on user_name
  • Eliminate filter mistakes by keeping only rows marked subscribed equals TRUE
  • Unify exports from many sources into one Google Sheet without copy paste
  • Track provenance by stamping each row with the source file name

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Google Sheets. See the Tools Required section above for links to create accounts with these services.
  3. Prepare your Google Sheet: create a worksheet with columns named user_name, subscribed, date_subscribed, and Source. Leave at least one empty row at the end.
  4. Open the Google Sheets node in the workflow. In the Document field, paste the full URL of your Google Sheet. Choose the correct sheet tab from the dropdown.
  5. Create Google Sheets credentials in n8n Cloud: double click the Google Sheets node, open the Credential to connect with dropdown, click Create new credential, pick Google Sheets OAuth2, then follow the on screen steps to sign in and allow access. Name the credential clearly for your team and save.
  6. Map columns in the Google Sheets node. Set operation to appendOrUpdate and select user_name as the match column if you want updates on existing entries. Confirm that user_name, subscribed, date_subscribed, and Source are present in the schema.
  7. Check the file input path. Open the Read Binary Files node and review the file selector. It is set to ./.n8n/*.csv. Place your CSV files in that folder or update the path to where your CSVs are stored.
  8. Verify CSV formatting. Each file should include a header row with user_name, subscribed, and date_subscribed. The subscribed values should be TRUE for active contacts.
  9. Run a test. Click Execute Workflow. Watch Split In Batches process one file at a time. Open the node outputs to confirm that the Source field shows the file name and that duplicates have been removed.
  10. Validate the results in Google Sheets. Confirm rows were appended or updated, the order is by date_subscribed, and the Source column is filled in.
  11. Troubleshoot common issues: if no rows appear, check the folder path and file names. If every row is filtered out, verify subscribed values are TRUE. If columns do not match, update the sheet headers or the node schema. If you see permission errors, reauthorize the Google Sheets credential.
  12. Optional tuning: keep the batch size at one for reliability with large files. If your dates are not sorting as expected, standardize date_subscribed format in your CSVs.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.