Skip to main content

Automated workflow backups from self-hosted n8n to Google Drive with version history

Workflow preview

Workflow preview
100%
Automated workflow backups from self-hosted n8n to Google Drive with version history preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

What problem does this workflow solve? If you're using a self hosted n8n instance, there's no built in version history or undo for your workflows. If a workflow is accidentally modified or delete...

Best for

  • DevOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.splitinbatches, n8n-nodes-base.scheduletrigger, n8n-nodes-base.n8n, n8n-nodes-base.googlesheets, n8n-nodes-base.googledrive, n8n-nodes-base.if, n8n-nodes-base.code, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by InfyOm Technologies.

Original n8n.io source

1.1 Workflow description

Title
Automated workflow backups from self-hosted n8n to Google Drive with version history
Workflow name
Automated workflow backups from self-hosted n8n to Google Drive with version history

βœ… What problem does this workflow solve?

If you're using a self-hosted n8n instance, there's no built-in version history or undo for your workflows. If a workflow is accidentally modified or deleted, there's no way to roll back. This backup workflow solves that problem by automatically syncing your workflows to Google Drive, giving you version control and peace of mind.


βš™οΈ What does this workflow do?

  • ⏱ Runs on a set schedule (e.g., daily or every 12 hours).
  • πŸ” Fetches all workflows from your self-hosted n8n instance.
  • 🧠 Detects changes to avoid duplicate backups.
  • πŸ“ Creates a dedicated folder for each workflow in Google Drive.
  • πŸ’Ύ Uploads new or updated workflow files in JSON format.
  • πŸ—ƒοΈ Keeps backup history organized by date.
  • πŸ”„ Allows for easy restore by importing backed-up JSON into n8n.

πŸ”§ Setup Instructions

1. Google Drive Setup

  • Connect your Google Drive account using the Google Drive node in n8n.
  • Choose or create a root folder (e.g., n8n-workflow-backups) where backups will be stored.

2. n8n API Credentials

  • Generate a Personal Access Token from your self-hosted n8n instance:
    • Go to Settings β†’ API in your n8n dashboard.
    • Copy the token and use it in the HTTP Request node headers as:
      Authorization: Bearer <your_token>
      

3. Schedule the Workflow

  • Use the Cron node to schedule this workflow to run at your desired frequency (e.g., once a day or every 12 hours).

🧠 How it Works

Step-by-Step Flow:

  1. Scheduled Trigger

    • The workflow begins on a timed schedule using the Cron node.
  2. Fetch All Workflows

    • Uses the n8n API (/workflows) to retrieve a list of all existing workflows.
  3. Loop Through Workflows

    • For each workflow:
      • A folder is created in Google Drive using the workflow name.
      • The workflow’s last updated timestamp is checked against Google Drive backups.
  4. Smart Change Detection

    • If the workflow has changed since the last backup:
      • A new .json file is uploaded to the corresponding folder.
      • The file is named with the last updated date of the workflow (YYYY-MM-DD-HH-mm-ss.json) to maintain a versioned history.
    • If no change is detected, the workflow is skipped.

πŸ—‚ Google Drive Folder Organization

Backups are neatly organized by workflow and version:

/n8n-workflow-backups/
β”œβ”€β”€ google-drive-backup-KqhdMBHIyAaE7p7v/
β”‚ β”œβ”€β”€ 2025-07-15-13-03-32.json
β”‚ β”œβ”€β”€ 2025-07-14-03-08-12.json
β”œβ”€β”€ resume-video-avatar-KqhdMBHIyAaE8p8vr/
β”‚ β”œβ”€β”€ 2025-07-15-23-05-52.json

Each folder is named after the workflow's name+id and contains timestamped versions.


πŸ”§ Customization Options

  • πŸ“… Change Backup Frequency
    Adjust the Cron node to run backups daily, weekly, or even hourly based on your needs.

  • πŸ“€ Use a Different Storage Provider
    You can swap out Google Drive for Dropbox, S3, or another cloud provider with minimal changes.

  • πŸ§ͺ Add Workflow Filtering
    Only back up workflows that are active or match specific tags by filtering results from the n8n API.


♻️ How to Restore a Workflow from Backup

  1. Go to the Google Drive backup folder for the workflow you want to restore.
  2. Download the desired .json file (based on the date).
  3. Open your self-hosted n8n instance.
  4. Click Import Workflow from the sidebar menu.
  5. Upload the JSON file to restore the workflow.

> You can choose to overwrite an existing workflow or import it as a new one.


πŸ‘€ Who can use this?

This template is ideal for:

  • πŸ§‘β€πŸ’» Developers running self-hosted n8n
  • 🏒 Teams managing large workflow libraries
  • πŸ” Anyone needing workflow versioning, rollback, or disaster recovery
  • πŸ’Ύ Productivity enthusiasts looking for automated backups

πŸ“£ Tip

Consider enabling version history in Google Drive so you get even more fine-grained backup recovery options on top of what this workflow provides!


πŸš€ Ready to use?

Just plug in your n8n token, connect Google Drive, and schedule your backups. Your workflows are now protected!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Loop Over Data

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 2 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 3 - Get all n8n Workflow

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 4 - Append row in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 5 - Store File in Subfolder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 6 - Search Subfolder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 7 - If Exit

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 8 - Create SubFolder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 9 - Get n8n File

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Set Subfolder Id

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Append or update row in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 12 - If Updated Date Changed

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - If not Exits

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 14 - Get Flow Record

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 15 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Get Exits Workflow

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

3. Summary Table

Workflow Automated workflow backups from self-hosted n8n to Google Drive with version history
Complexity advanced
Nodes 16
Categories DevOps
Author InfyOm Technologies
Published 09 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5802/5802.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated workflow backups from self-hosted n8n to Google Drive with version history do?

What problem does this workflow solve? If you're using a self hosted n8n instance, there's no built in version history or undo for your workflows. If a workflow is accidentally modified or delete...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.