Document Synchronization Between SharePoint and Google Drive - n8n Workflow

Use this efficient n8n workflow template to automatically sync documents between Microsoft SharePoint and Google Drive, leveraging a Supabase or Postgres database for metadata tracking and efficient change detection.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical teams needing reliable, scheduled document backup from SharePoint to Google Drive.

  • Users looking for robust delta synchronization solutions implemented in an n8n workflow.

  • Developers requiring an n8n template for managing file metadata across systems using Supabase or PostgreSQL.

Overview

Managing file synchronization across large organizations that use multiple cloud environments (like Microsoft SharePoint and Google Drive) can be complex and inefficient. This powerful n8n workflow solves this problem by providing a scheduled, metadata-driven synchronization engine. It avoids unnecessary reprocessing by storing file metadata (like unique ID and last modified date) in a dedicated database (Supabase/Postgres).

This n8n automation template ensures that only truly new or modified files are downloaded from SharePoint and uploaded to Google Drive, drastically reducing bandwidth and execution time. Furthermore, the logic handles the identification of deleted files and filters out system files, making this n8n workflow an ideal solution for enterprise data management.

How it Works

The synchronization process starts with the n8n trigger, which is configured as a scheduled execution:


  1. Trigger & Metadata Retrieval: The Schedule Trigger initiates the n8n workflow. Simultaneously, it fetches the existing file metadata from the n8n_metadata table in Supabase/Postgres and recursively retrieves the current file and folder structure from SharePoint via an n8n HTTP Request node.

  2. Data Preparation: A Code n8n node flattens the recursive SharePoint folder structure and filters out unwanted system files (e.g., temporary Office files, .db). The timestamps of the files are then normalized using an n8n Set node.

  3. Delta Detection: The core logic uses the Compare Datasets n8n node to perform a delta check. It compares the live SharePoint data against the stored Supabase metadata, identifying new files, modified files, and files that have been deleted from SharePoint (which are then deleted from the Supabase record).

  4. Looping & Processing: Only newly created or modified files proceed to a batch loop. Inside the loop, another Code n8n node constructs the final file URL, and an n8n Set node prepares standardized metadata.

  5. Database Upsert & Download: The file metadata is immediately upserted (inserted/updated) in the Postgres/Supabase table. The subsequent SharePoint HTTP Request n8n node downloads the actual binary content of the file.

  6. Google Drive Upload: A final Code n8n node dynamically renames the binary file data using the clean file title. The file is then uploaded to Google Drive using the dedicated Google Drive n8n node.

  7. Status Update: Finally, a Postgres n8n node updates the Supabase record for the specific file, marking the process as complete (Loading Done = true).

Installation Guide

To deploy this synchronization n8n workflow, follow these steps:


  1. Import: Import this JSON into your n8n instance as a new n8n workflow.

  2. Credentials: Set up credentials for the following services:

Microsoft SharePoint OAuth2 API: Required for both listing files and downloading their content.
Supabase/Postgres Credentials: Required for the Supabase and Postgres n8n node operations (ensure the n8n_metadata table exists).
* Google Drive OAuth2 API: Required for uploading the synchronized files.

  1. Configuration (SharePoint): Update the URL parameter in the Microsoft SharePoint HTTP Request n8n node (7cb642b1) and Microsoft SharePoint HTTP Request1 (52071823) with your specific tenant, site, and document library paths.

  2. Configuration (Filter): Review and modify the excludedExtensions array in the filter files Code n8n node if you need to exclude different file types.

  3. Activation: Set the desired frequency in the Schedule Trigger n8n trigger node and activate the n8n workflow.

Node Details

Schedule Trigger (n8n trigger): The entry point of the n8n workflow, defining the automated execution frequency.
Supabase (Get): Retrieves all existing records from the n8nmetadata table to serve as the baseline for delta comparison.
Microsoft SharePoint HTTP Request (n8n node): Uses a complex $expand OData query to recursively fetch all folders and files from the target SharePoint document library.
filter files (Code n8n node): This crucial custom n8n node flattens the nested JSON structure into a single file list and excludes files matching patterns like ~$ or specified extensions (.db, .msg, etc.).
Compare Datasets (n8n node): Performs the delta logic, comparing the SharePoint file list against Supabase records using fields like sharepointfileid and TimeLastModified to determine which files are new, modified, or deleted.
Supabase1 (n8n node): Deletes metadata records for files identified as removed from SharePoint.
Microsoft SharePoint HTTP Request1 (n8n node): Downloads the specific file content marked for synchronization. The response format is set to file to handle binary data.
rename files (Code n8n node): Renames the binary data object internally using the clean file title before passing it to Google Drive. This is required because the SharePoint download doesn't always provide a clean file name for the binary.
Upload file (Google Drive n8n node): Handles the final storage operation, uploading the newly downloaded and renamed binary file to the specified location in Google Drive.
Postgres (n8n node): Executes an UPDATE operation on n8n
metadata to set the Loading Done flag to true, finalizing the processing status for the synchronized file.

Related n8n Workflows

Free

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

Digital Biz Tech helps organizations turn their knowledge and workflows into practical, AI-driven systems. From zero-retention assistants that provide secure, social media automation that generate and schedule on-brand campaigns, we enable teams to work faster, smarter, and with complete confidence in their data. For consulting or collaborations, reach out at: [email protected] Website: https://www.digitalbiz.tech You can also DM us on LinkedIn for any help..

Featured*