AutomationFlowsData & Sheets › Automated Workflow Backups From Self-hosted N8n to Google Drive with Version…

Automated Workflow Backups From Self-hosted N8n to Google Drive with Version…

Original n8n title: Automated Workflow Backups From Self-hosted N8n to Google Drive with Version History

ByInfyOm Technologies @infyom on n8n.io

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…

Cron / scheduled trigger★★★★☆ complexity16 nodesn8nGoogle SheetsGoogle Drive
Data & Sheets Trigger: Cron / scheduled Nodes: 16 Complexity: ★★★★☆ Added:
Automated Workflow Backups From Self-hosted N8n to Google Drive with Version… — n8n workflow card showing n8n, Google Sheets, Google Drive integration

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

This workflow follows the Google Drive → Google Sheets recipe pattern — see all workflows that pair these two integrations.

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": "KqhdMBHIyAaE7p7v",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "n8n Backup Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "4c586a42-d1a9-4ce5-a88a-c06af6c9f868",
      "name": "Loop Over Data",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -40,
        1760
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "e9d58b37-cd4d-4745-a076-4d9b32b3f7ce",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -440,
        1760
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 1,
              "triggerAtMinute": 30
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a81a639f-ccd2-4121-a44c-5fdb3bc5adca",
      "name": "Get all n8n Workflow",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -260,
        1760
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "51a9cf22-6930-4e12-ad85-6d21492a3077",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        500,
        1720
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $('Loop Over Data').item.json.id }}",
            "Name": "={{ $('Loop Over Data').item.json.name }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Backup",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Last Backup",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Updated",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Last Updated",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Folder link",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Folder link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit?usp=drivesdk",
          "cachedResultName": "Workflow Backup"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0bd83570-28b1-4c15-82a7-bc8399d1fccd",
      "name": "Store File in Subfolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        460,
        2000
      ],
      "parameters": {
        "name": "={{ $('Loop Over Data').item.json.updatedAt.toDateTime().format('yyyy-MM-dd-hh-mm-ss') }}.json",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Subfolder Id').item.json.id }}"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 3
    },
    {
      "id": "70d06585-57d8-42c3-847e-95b4e34d1652",
      "name": "Search Subfolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        880,
        1740
      ],
      "parameters": {
        "limit": 1,
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1RlTOTLu0k698vMBJjFSFXfdZw0C5sG8c",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1RlTOTLu0k698vMBJjFSFXfdZw0C5sG8c",
            "cachedResultName": "n8n workflows"
          }
        },
        "options": {},
        "resource": "fileFolder",
        "queryString": "={{ $json.id }}"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "3d8f6803-ddac-4d5e-8a6b-59965ba01f08",
      "name": "If Exit",
      "type": "n8n-nodes-base.if",
      "position": [
        -380,
        2040
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1e01d47-0001-4941-bc61-e1e5f753238e",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d09a373b-4882-483c-910f-f68699b98c9e",
      "name": "Create SubFolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -200,
        2080
      ],
      "parameters": {
        "name": "={{ \n  (`${$('Loop Over Data').item.json.name}-${$('Loop Over Data').item.json.id}`)\n    .toLowerCase()\n    .replace(/\\s+/g, '-')\n    .slice(0, 50) \n}}\n\n",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "1RlTOTLu0k698vMBJjFSFXfdZw0C5sG8c"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e4e8ffcd-c56c-420c-83a6-c720a06878f2",
      "name": "Get n8n File",
      "type": "n8n-nodes-base.code",
      "position": [
        280,
        2000
      ],
      "parameters": {
        "jsCode": "// Convert the input data to a Buffer and create a binary file\nconst jsonData = $(\"Loop Over Data\").all(); // Get JSON from previous node\nconst fileContent = Buffer.from(JSON.stringify(jsonData, null, 2)); // Convert JSON to string and then to Buffer\n\nreturn [\n  {\n    json: {},\n    binary: {\n      data: {\n        data: fileContent.toString('base64'), // Convert buffer to base64\n        mimeType: 'application/json',\n        fileName: 'data.json'\n      }\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "9798b124-192f-42c1-b196-fd50fc46c71d",
      "name": "Set Subfolder Id",
      "type": "n8n-nodes-base.set",
      "position": [
        80,
        2000
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5b3b2989-3e63-49cd-bb93-ec82603356bb",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "558fb06a-871d-46cf-9365-1a22ea21cb20",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e37485da-b923-4d89-ac7e-f98e57d35220",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        700,
        2000
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $('Get Flow Record').item.json.id }}",
            "Folder link": "=https://drive.google.com/drive/u/0/folders/{{ $json.parents[0] }}",
            "Last Backup": "={{ new Date().toISOString() }}-{{ $('Loop Over Data').item.json.name }}",
            "Last Updated": "={{ $('Loop Over Data').item.json.updatedAt }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Backup",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Last Backup",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Updated",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Last Updated",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Folder link",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Folder link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Workflow data",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Workflow data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit?usp=drivesdk",
          "cachedResultName": "Workflow Backup"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "d52e4cdc-7181-4d10-91fe-0da3da9b3da4",
      "name": "If Updated Date Changed",
      "type": "n8n-nodes-base.if",
      "position": [
        -180,
        1920
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b5fcdfe8-6565-4b08-8f2b-39169acc41da",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Get Flow Record').item.json['Last Updated'] === $('Loop Over Data').item.json.updatedAt  ? \"Not Requied\" : \"Required\"}}",
              "rightValue": "Required"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1298d79b-d3c7-43c0-b2fd-e24cc82207aa",
      "name": "If not Exits",
      "type": "n8n-nodes-base.if",
      "position": [
        320,
        1760
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "00b720da-35c2-4047-8a7f-6a09538f579f",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "77c71084-44ee-405a-a1e2-9b1d1668f05f",
      "name": "Get Flow Record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        700,
        1740
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.id }}",
              "lookupColumn": "id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit?usp=drivesdk",
          "cachedResultName": "Workflow Backup"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "b41d7294-9e47-4984-9d4b-a6a7b681cac3",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        1300
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 420,
        "content": "## Setup Steps\n\n### API Configuration \n1. **Google Drive Integration**:\n   - Set up Google Drive OAuth2 credentials in n8n.\n   - Specify the root folder or desired location for backups.\n2. **n8n API Access**:\n   - Configure n8n API credentials to allow fetching workflows.\n\n### Workflow Customization \n1. Define the schedule for automatic backups (e.g., daily at midnight).\n2. Set Parent Google Drive Folder in \"Search Subfolder\" Node\n\n### Sample Sheet for Stored n8n Workflows\nhttps://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit?gid=0#gid=0"
      },
      "typeVersion": 1
    },
    {
      "id": "65f84929-89f2-448d-a1d9-4757043b9740",
      "name": "Get Exits Workflow",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        140,
        1760
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.id }}",
              "lookupColumn": "id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qdv_eQ0O1RPccUf819OVlDY9Z3FSAQTU5R673CjKlxc/edit?usp=drivesdk",
          "cachedResultName": "Workflow Backup"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fa19136a-182f-4486-96ab-da23ecfc9409",
  "connections": {
    "If Exit": {
      "main": [
        [
          {
            "node": "If Updated Date Changed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create SubFolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get n8n File": {
      "main": [
        [
          {
            "node": "Store File in Subfolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If not Exits": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Flow Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Data": {
      "main": [
        [],
        [
          {
            "node": "Get Exits Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Flow Record": {
      "main": [
        [
          {
            "node": "Search Subfolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create SubFolder": {
      "main": [
        [
          {
            "node": "Set Subfolder Id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get all n8n Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Subfolder": {
      "main": [
        [
          {
            "node": "If Exit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Subfolder Id": {
      "main": [
        [
          {
            "node": "Get n8n File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Exits Workflow": {
      "main": [
        [
          {
            "node": "If not Exits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Get Flow Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all n8n Workflow": {
      "main": [
        [
          {
            "node": "Loop Over Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Updated Date Changed": {
      "main": [
        [
          {
            "node": "Set Subfolder Id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store File in Subfolder": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

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…

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

More Data & Sheets workflows → · Browse all categories →

Related workflows

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

Data & Sheets

This workflow monitors Google Calendar for events indicating that a customer will visit the company today or the next day, retrieves the required details, and sends reminder notifications to the relev

Google Calendar, Google Sheets, HTTP Request +1
Data & Sheets

Useful if a team is working within a single instance and you want to be notified of what workflows have changed since you last visited them. Another use-case might be monitoring your managed instances

Google Sheets, Execute Workflow Trigger, n8n
Data & Sheets

Transform your n8n instance management with this advanced automation system featuring artificial intelligence-driven workflow selection. This template provides comprehensive maintenance operations wit

n8n, HTTP Request, Google Sheets +1
Data & Sheets

This n8n workflow automatically finds apartments for rent in Germany, filters them by your city, rent budget, and number of rooms, and applies to them via email. Each application includes: A personali

HTTP Request, Google Drive, Email Send +1
Data & Sheets

Workflow Overview Zoom Attendance Evaluator with Follow-up is an n8n automation workflow that automatically evaluates Zoom meeting attendance and sends follow-up emails to no-shows and early leavers w

Zoom, Item Lists, HTTP Request +3