Automated Google Drive to FTP Data Synchronization and Reporting - n8n Workflow

A comprehensive n8n workflow designed for secure, automated file transfer from Google Drive to an FTP server. Features include file validation, custom JSON logging, dynamic error handling, and end-of-run email reports. Utilize this n8n template for robust data synchronization.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Data Engineers & Analysts: Needing reliable, scheduled migration of reports or data dumps from cloud storage to legacy systems. IT Administrators: Seeking an automated solution for backup or synchronization between Google Workspace and private FTP servers.* Advanced n8n Users: Those looking for complex n8n templates that showcase custom flow control, error handling, and dynamic JSON manipulation within a single n8n workflow.

Overview

Managing file synchronization across disparate systems like Google Drive and a dedicated FTP server can be complex and error-prone when done manually. This robust n8n workflow solves this by providing a hands-free, scheduled solution that not only transfers files but also implements rigorous data integrity checks.

The automation uses a custom n8n node logic to filter files by size (max 50MB) and extension (.pdf, .zip, .xlsx, etc.) before processing. Crucially, the entire run is logged into a structured JSON object, tracking successful transfers, failures, and skipped files. This detailed logging structure, managed entirely within the n8n workflow, ensures complete traceability. The process concludes by uploading the final JSON log back to Google Drive for archiving and notifying stakeholders via email. This powerful n8n template ensures data reliability and operational transparency.

How it Works

The n8n workflow can be initiated via two methods: a periodic Schedule Trigger (every 6 hours) for continuous syncing, or an immediate Webhook Trigger for on-demand transfers.


  1. File Retrieval and Initialization: The n8n trigger starts the process by retrieving the latest files from Google Drive using the Google Drive n8n node.

  2. Validation and Logging Setup: The Filter & Validate Files Code n8n node is the core logic engine. It initializes a transferNotes JSON object to meticulously track metadata and run settings. It then iterates through all Drive files, filters them based on predefined rules, and separates the valid files from the skipped ones, logging all actions.

  3. Iterative Processing: The workflow uses the Process One by One Split In Batches n8n node to ensure reliable, sequential transfer of each file.

  4. Transfer and Error Handling: For each file, the Google Drive n8n node downloads the binary data, which is immediately sent to the Upload to FTP n8n node.

  5. Status Update: Depending on the outcome of the FTP transfer, the flow splits. The file data is routed either to the Update Notes - Success Code n8n node or, upon failure, to the Update Notes - Error Code n8n node. Both branches append a detailed record (success or failure message, timestamp, size) back to the master transferNotes log.

  6. Looping and Conclusion: The Check if More Files IF n8n node determines if the next file in the batch should be processed. Once all files are handled, the flow exits the loop.

  7. Final Reporting: The Create Final Report Code n8n node compiles the detailed transferNotes into a human-readable summary. This report is then saved as a date-stamped JSON file using the Save Notes JSON n8n node, uploaded to Google Drive for permanent storage, and finally summarized and distributed via the Send Report Email n8n node.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Template: Copy the provided JSON code and import it into your n8n instance via the 'New' menu > 'Import from JSON'.

  2. Configure Credentials: Google Drive: You must set up a credential for the Google Drive n8n node, ensuring it has read access to the source folder and write access to the report archive folder. FTP: Set up credentials for the FTP n8n node (host, username, password/key). Verify the path defined in the 'Upload to FTP' node (/remote/directory/) exists.* Email: Configure your EmailSend n8n node credentials (SMTP settings) for report delivery, and fill in the required 'To' field for recipients.

  3. Activate the n8n Trigger: Ensure the webhook is active and the Schedule Trigger is set to your preferred frequency (currently every 6 hours).

  4. Customization: Edit the Filter & Validate Files Code n8n node to adjust the maxFileSizeMB (currently 50MB) or change the allowedExtensions list to suit your specific data requirements.

Node Details

Schedule Trigger / Webhook Trigger (n8n trigger): Initiates the n8n workflow automatically every 6 hours or manually via a POST request to /webhook-transfer-status. Get Drive Files (Google Drive n8n node): Retrieves the list of files to be processed from the specified Google Drive location. Filter & Validate Files (Code n8n node): Initializes the transfer log structure (transferNotes). It enforces file size and extension policies, skipping non-compliant files and preparing the list of files ready for transfer. This is a critical custom logic step in the n8n workflow. Process One by One (Split In Batches n8n node): Ensures that files are processed sequentially, allowing the error handling and logging nodes to correctly reference the specific file currently being handled. Upload to FTP (FTP n8n node): Connects to the remote FTP server and transfers the binary file data downloaded from Drive. The destination path is dynamically constructed using expressions. Update Notes - Success/Error (Code n8n node): These nodes are responsible for error handling and logging. They dynamically update the master transferNotes JSON object, incrementing success or failure counters and recording transfer details or error messages. Save Notes JSON (Write Binary File n8n node): Converts the final, compiled JSON report into a binary file format, ready for storage. Upload Notes to Drive (Google Drive n8n node): Archives the final transfer log JSON file back into Google Drive, providing an audit trail for every execution of the n8n workflow.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Featured*