AutomationFlowsGeneral › Back Up Self-hosted Workflows to Google Drive on a Schedule

Back Up Self-hosted Workflows to Google Drive on a Schedule

ByShahzaib Anwar @shahzaibanwar on n8n.io

This workflow automatically backs up all your n8n workflows to Google Drive on a schedule.

Cron / scheduled trigger★★★★☆ complexity16 nodesGoogle Driven8n
General Trigger: Cron / scheduled Nodes: 16 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #15683 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "nuWYPyPe0Tuzo532",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Self-Hosted n8n Workflow Backup to Google Drive",
  "tags": [],
  "nodes": [
    {
      "id": "4139a02d-c8b0-4da7-83a3-194ced8080aa",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 480,
        "height": 688,
        "content": "## Self-Hosted n8n Workflow Backup to Google Drive\n\n### How it works\n\n1. Triggers the workflow on a defined schedule.\n2. Creates a folder in Google Drive for storing backups.\n3. Retrieves workflows and processes them for backup.\n4. Converts data to a file and uploads it to Google Drive.\n5. Manages previous backup folders by searching, sorting, filtering, and deleting as needed.\n\n### Setup steps\n\n- [ ] Configure Google Drive credentials to allow API access for file operations.\n- [ ] Ensure n8n has been set up with necessary permissions to fetch and manage workflows.\n- [ ] Schedule the trigger to define how frequently backups occur.\n\n### Customization\n\nYou can customize the frequency of the schedule trigger and the criteria for old folder management."
      },
      "typeVersion": 1
    },
    {
      "id": "0380f079-2550-4d2b-9701-698ef41a3f75",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 304,
        "content": "## Initialize backup sequence\n\nStarts the workflow on a schedule and initiates Google Drive folder creation."
      },
      "typeVersion": 1
    },
    {
      "id": "aafe6206-63f5-4b41-8674-062ccfb69b38",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 304,
        "content": "## Retrieve and process workflows\n\nFetches workflows and prepares them for conversion to files."
      },
      "typeVersion": 1
    },
    {
      "id": "5599cb1c-2649-4e46-a550-016f9b651056",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 384,
        "content": "## Convert and upload files\n\nConverts workflows to files and uploads them to Google Drive."
      },
      "typeVersion": 1
    },
    {
      "id": "1eb4f1c1-9b0e-449a-a636-db2fa7c086b7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 1088,
        "height": 272,
        "content": "## Manage old backups\n\nLimits, searches, sorts, filters, and deletes old backup folders on Google Drive."
      },
      "typeVersion": 1
    },
    {
      "id": "8c065ae0-1132-4bdd-8d27-4e2d82b87996",
      "name": "Create folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        832,
        432
      ],
      "parameters": {
        "name": "=n8n-backup-{{ $now.format('yyyy-MM-dd-HH-mm') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "REPLACE_WITH_GOOGLE_DRIVE_PARENT_FOLDER_ID",
          "cachedResultName": "Select your backup parent folder"
        },
        "resource": "folder"
      },
      "typeVersion": 3
    },
    {
      "id": "49088be5-9f8a-4a99-bf0a-53d20203975e",
      "name": "Get many workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1056,
        432
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "59915bb9-4d85-47fd-8a5d-2979c4719d3a",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1280,
        432
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "c5077e95-6781-480f-9701-ffe90371b69d",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1504,
        432
      ],
      "parameters": {
        "mode": "each",
        "options": {
          "fileName": "={{ $json.name.replace(/[\\\\/:*?\"<>|]/g, \"-\") }}.json"
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "00b1981d-4a2a-4241-9b65-77cea947578b",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1728,
        512
      ],
      "parameters": {
        "name": "={{ $binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create folder').first().json.id }}"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "0dcd1ef9-1199-4df6-a16b-35489481c264",
      "name": "Search files and folders",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1728,
        112
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "id",
            "value": "REPLACE_WITH_GOOGLE_DRIVE_PARENT_FOLDER_ID",
            "cachedResultName": "Select your backup parent folder"
          }
        },
        "options": {},
        "resource": "fileFolder",
        "queryString": "n8n-backup-"
      },
      "typeVersion": 3
    },
    {
      "id": "86a054be-546a-4973-8fac-d5fb5a4a16d2",
      "name": "Sort",
      "type": "n8n-nodes-base.sort",
      "position": [
        1952,
        112
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "order": "descending",
              "fieldName": "name"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "27285eeb-1eb9-432a-aee4-a884bc794e8b",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        2176,
        112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0f117735-1005-4075-b4d3-dd8afe4649dd",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "={{ $('Create folder').first().json.id }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "6d659cf3-9ecf-4e42-9624-ebffb69cb73f",
      "name": "Delete folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2400,
        112
      ],
      "parameters": {
        "options": {},
        "resource": "folder",
        "operation": "deleteFolder",
        "folderNoRootId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "2804086b-808e-4489-b165-f2d25def9ca7",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        1504,
        112
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "129e187e-8490-469c-bbed-0d1dd1d22306",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        608,
        432
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 10
            }
          ]
        }
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "c58b4c9a-003f-4946-b116-259f1646d517",
  "connections": {
    "Sort": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Delete folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create folder": {
      "main": [
        [
          {
            "node": "Get many workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Create folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many workflows": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Sort",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow automatically backs up all your n8n workflows to Google Drive on a schedule.

Source: https://n8n.io/workflows/15683/ — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

How it works

Google Drive, n8n
General

This workflow is designed for n8n users who want an automated way to back up their workflows to Google Drive. It is useful for freelancers, developers, automation agencies, and teams managing multiple

Google Drive, n8n
General

This workflow is designed to automatically create backups of all your workflows in n8n and store them as individual .json files in Google Drive. It's a fully automated system that helps developers, ag

Google Drive, n8n
General

This workflow automates the backup of your n8n workflows data to Google Drive every day.

n8n, Google Drive
General

Back up n8n workflows to Google Drive automatically This workflow provides a robust solution for backing up your n8n workflows to Google Drive. It is designed to handle backups for multiple n8n instan

Execute Workflow Trigger, n8n, Google Drive