Automatisierte Sicherung von Workflows zu Google Drive mit intelligenter Bereinigung
Experte
Dies ist ein DevOps, Multimodal AI-Bereich Automatisierungsworkflow mit 17 Nodes. Hauptsächlich werden N8n, Set, Code, GoogleDrive, ConvertToFile und andere Nodes verwendet. Automatisches Backup von Arbeitsabläufen nach Google Drive mit intelligenter Bereinigung
Voraussetzungen
- •Google Drive API-Anmeldedaten
Verwendete Nodes (17)
Kategorie
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
"meta": {
"instanceId": "c582d54231d7262c638a00ee408faa972b8030c20ecfa02b3d445f84745245ff",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "b7a4ebea-711b-473d-b18a-7bf84a888a17",
"name": "Zeitplan-Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1456,
-72
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 3
}
]
}
},
"typeVersion": 1.2
},
{
"id": "c7d51e5b-0add-4c66-8d85-e98d3a09f72e",
"name": "Manueller Trigger",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1456,
-264
],
"parameters": {},
"typeVersion": 1
},
{
"id": "73b8a7f5-d038-4366-b30b-a92195db3a35",
"name": "Dateien und Ordner suchen",
"type": "n8n-nodes-base.googleDrive",
"position": [
-16,
-480
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('CONFIG - Set your variables here').item.json.parentFolderId }}"
}
},
"options": {},
"resource": "fileFolder",
"returnAll": true,
"queryString": "Workflows backup - "
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "ardYGrL3hsVqtoGo",
"name": "Google Drive"
}
},
"typeVersion": 3
},
{
"id": "adc967fc-746c-462c-9de8-f823100d833d",
"name": "Bereinigung starten (einmal ausführen)",
"type": "n8n-nodes-base.set",
"position": [
-240,
-480
],
"parameters": {
"options": {}
},
"executeOnce": true,
"typeVersion": 3.4
},
{
"id": "1f4ad497-fbf8-4053-80fc-f22c9200370c",
"name": "Alte Ordner sortieren und isolieren",
"type": "n8n-nodes-base.code",
"position": [
208,
-480
],
"parameters": {
"jsCode": "// Get the number of backups to keep from the config node\nconst backupsToKeep = $json.backupsToKeep;\n\n// 'items' contains the list of folders from the previous node\nconst folders = $input.all(); \nconst sortedFolders = folders.map(item => item.json);\n\n// 1. Sort the folders from newest to oldest\nsortedFolders.sort((a, b) => new Date(b.createdTime) - new Date(a.createdTime));\n\n// 2. Get only the excess folders to delete\nconst foldersToDelete = sortedFolders.slice(backupsToKeep);\n\n// 3. Return the final list to be passed to the loop\nreturn foldersToDelete;"
},
"typeVersion": 2
},
{
"id": "ff6c6c87-2751-4429-a196-edc65f898e43",
"name": "Ordner zum Löschen durchlaufen",
"type": "n8n-nodes-base.splitInBatches",
"position": [
432,
-480
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "7669d1df-6225-47aa-841b-c14f48cbd2e3",
"name": "Jeden Workflow durchlaufen",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-560,
-144
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "c7a911aa-e8a2-42a3-a64b-5c2c4318720a",
"name": "Alle n8n Workflows abrufen",
"type": "n8n-nodes-base.n8n",
"position": [
-784,
-144
],
"parameters": {
"filters": {},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "iV99kO3Ts0Yartt4",
"name": "N8n"
}
},
"executeOnce": false,
"retryOnFail": false,
"typeVersion": 1,
"alwaysOutputData": false
},
{
"id": "20acb740-7157-4e30-bd4d-04b8663a8f8d",
"name": "Neuen Backup-Ordner erstellen",
"type": "n8n-nodes-base.googleDrive",
"position": [
-1008,
-144
],
"parameters": {
"name": "=Workflows backup - {{ $now.format('yyyy-MM-dd') }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('CONFIG - Set your variables here').item.json.parentFolderId }}"
},
"resource": "folder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "ardYGrL3hsVqtoGo",
"name": "Google Drive"
}
},
"typeVersion": 3
},
{
"id": "82b9a618-2765-4c53-baa7-66a025808c2d",
"name": "Workflow in Datei konvertieren",
"type": "n8n-nodes-base.convertToFile",
"position": [
-240,
16
],
"parameters": {
"options": {
"format": true,
"fileName": "={{ $json.name + \".json\" }} "
},
"operation": "toJson"
},
"typeVersion": 1.1
},
{
"id": "1f14d31c-9ab6-4b4f-b054-a02f1b75336f",
"name": "Workflow auf Google Drive hochladen",
"type": "n8n-nodes-base.googleDrive",
"position": [
-16,
16
],
"parameters": {
"name": "={{ $('Loop over each workflow').item.json.name + \".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": "={{ $('Create new backup folder').item.json.id }}"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "ardYGrL3hsVqtoGo",
"name": "Google Drive"
}
},
"typeVersion": 3
},
{
"id": "db4893e5-8a63-4d3d-9067-6a6d68ed3119",
"name": "Alten Ordner löschen",
"type": "n8n-nodes-base.googleDrive",
"position": [
656,
-480
],
"parameters": {
"options": {},
"resource": "folder",
"operation": "deleteFolder",
"folderNoRootId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "ardYGrL3hsVqtoGo",
"name": "Google Drive"
}
},
"typeVersion": 3
},
{
"id": "d6769f88-ffc4-4c1d-b8be-082109b12dde",
"name": "KONFIG – Variablen hier festlegen",
"type": "n8n-nodes-base.set",
"position": [
-1232,
-144
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5da1b756-88b7-4ba2-bc87-0ea4298b78ce",
"name": "parentFolderId",
"type": "string",
"value": "PASTE_YOUR_GOOGLE_DRIVE_PARENT_FOLDER_ID_HERE"
},
{
"id": "79da4836-d768-4b7d-b64f-bc820583613a",
"name": "backupsToKeep",
"type": "number",
"value": 30
}
]
}
},
"typeVersion": 3.4
},
{
"id": "06268a9d-854e-47ee-b6f5-38c8dd57ee20",
"name": "Haftnotiz",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2112,
-336
],
"parameters": {
"width": 560,
"height": 432,
"content": "## How to find your Google Drive Folder ID\nTo tell the workflow where to save your backups, you need to provide the ID of a parent folder in your Google Drive.\n\n1. Go to [Google Drive](https://drive.google.com) and navigate to the folder you want to use. You can also create a new one (e.g., a folder named \"n8n Backups\").\n2. Click on the folder to open it.\n3. Look at the URL in your browser's address bar. The Folder ID is the long string of characters at the end of the URL.\n\n**Example:**\nIf your browser URL is:\n`https://drive.google.com/drive/folders/`**`1Fs3gg7pSVhbvODJQLcgAfP-V0rCGC_Oc`**\n\nThen your Folder ID is:\n**`1Fs3gg7pSVhbvODJQLcgAfP-V0rCGC_Oc`**\n\nCopy this ID and paste it into the `parentFolderId` field in the **\"CONFIG - Set your variables here\"** node."
},
"typeVersion": 1
},
{
"id": "1907cd86-02d6-473a-a605-4518d83c2b1b",
"name": "Haftnotiz 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
-608
],
"parameters": {
"color": 7,
"width": 1168,
"height": 336,
"content": "## Cleanup Logic: Finds and deletes old backup folders\nThis first part of the workflow handles automatic maintenance. It searches for all existing backup folders in your Google Drive, sorts them by creation date, and keeps only the most recent ones (the number is configurable). All older folders are then automatically deleted to save space.\n\n"
},
"typeVersion": 1
},
{
"id": "dcad82b1-69e9-484f-8d06-cadc311a5ac7",
"name": "Haftnotiz 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
-208
],
"parameters": {
"color": 7,
"width": 544,
"height": 432,
"content": "## Backup Logic: Fetches all workflows and uploads them to a new daily folder\nThis is the core backup process. It begins by creating a new, dated folder for the current day's backup. It then fetches a complete list of all your n8n workflows, converts each one into a .json file, and uploads them to the new folder, creating a complete and organized daily snapshot."
},
"typeVersion": 1
},
{
"id": "fb976047-3811-437a-b19c-de8def3fe06c",
"name": "Haftnotiz 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2736,
-560
],
"parameters": {
"width": 560,
"height": 848,
"content": "## Backup n8n workflows to Google Drive with automatic cleanup\n\nThis template automates the process of backing up all your n8n workflows to Google Drive, ensuring you always have a safe copy of your automations. It also includes a smart cleanup mechanism to automatically delete old backups, keeping your Drive organized and saving space.\n\n## Who’s it for\nThis workflow is ideal for any n8n user, from solo developers to teams, who want a reliable and automated \"set-it-and-forget-it\" backup solution for their critical workflows.\n\n## What it does\n* **Daily Execution**: The workflow runs automatically every night (or can be triggered manually).\n* **Automated Cleanup**: After running a new backup, it searches for all previous backup folders. It keeps the most recent ones (you can define how many) and deletes all the older folders.\n* **Creates Daily Folders**: It creates a new, neatly named folder in your Google Drive for each day's backup (e.g., `Workflows backup - 2025-08-17`).\n* **Fetches and Saves**: It connects to your n8n instance via API, fetches all your workflows, and saves each one as a `.json` file inside the daily folder.\n\n## How to set up\n1. **Configure Credentials**: Make sure you have valid credentials for:\n * **n8n API**: To allow the workflow to access its own list of workflows.\n * **Google Drive**: To allow the workflow to create folders and upload files.\n2. **Set Your Variables**: In the first `Set` node named **\"CONFIG - Set your variables here\"**:\n * `parentFolderId`: Paste the ID of the main Google Drive folder where you want all your daily backup folders to be stored.\n * `backupsToKeep`: Set the number of recent backups you wish to keep (e.g., 30 for a month's worth).\n\nActivate the workflow, and you're all set!"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"c7d51e5b-0add-4c66-8d85-e98d3a09f72e": {
"main": [
[
{
"node": "d6769f88-ffc4-4c1d-b8be-082109b12dde",
"type": "main",
"index": 0
}
]
]
},
"b7a4ebea-711b-473d-b18a-7bf84a888a17": {
"main": [
[
{
"node": "d6769f88-ffc4-4c1d-b8be-082109b12dde",
"type": "main",
"index": 0
}
]
]
},
"db4893e5-8a63-4d3d-9067-6a6d68ed3119": {
"main": [
[
{
"node": "ff6c6c87-2751-4429-a196-edc65f898e43",
"type": "main",
"index": 0
}
]
]
},
"c7a911aa-e8a2-42a3-a64b-5c2c4318720a": {
"main": [
[
{
"node": "7669d1df-6225-47aa-841b-c14f48cbd2e3",
"type": "main",
"index": 0
}
]
]
},
"7669d1df-6225-47aa-841b-c14f48cbd2e3": {
"main": [
[
{
"node": "adc967fc-746c-462c-9de8-f823100d833d",
"type": "main",
"index": 0
}
],
[
{
"node": "82b9a618-2765-4c53-baa7-66a025808c2d",
"type": "main",
"index": 0
}
]
]
},
"82b9a618-2765-4c53-baa7-66a025808c2d": {
"main": [
[
{
"node": "1f14d31c-9ab6-4b4f-b054-a02f1b75336f",
"type": "main",
"index": 0
}
]
]
},
"20acb740-7157-4e30-bd4d-04b8663a8f8d": {
"main": [
[
{
"node": "c7a911aa-e8a2-42a3-a64b-5c2c4318720a",
"type": "main",
"index": 0
}
]
]
},
"73b8a7f5-d038-4366-b30b-a92195db3a35": {
"main": [
[
{
"node": "1f4ad497-fbf8-4053-80fc-f22c9200370c",
"type": "main",
"index": 0
}
]
]
},
"adc967fc-746c-462c-9de8-f823100d833d": {
"main": [
[
{
"node": "73b8a7f5-d038-4366-b30b-a92195db3a35",
"type": "main",
"index": 0
}
]
]
},
"ff6c6c87-2751-4429-a196-edc65f898e43": {
"main": [
[],
[
{
"node": "db4893e5-8a63-4d3d-9067-6a6d68ed3119",
"type": "main",
"index": 0
}
]
]
},
"1f4ad497-fbf8-4053-80fc-f22c9200370c": {
"main": [
[
{
"node": "ff6c6c87-2751-4429-a196-edc65f898e43",
"type": "main",
"index": 0
}
]
]
},
"1f14d31c-9ab6-4b4f-b054-a02f1b75336f": {
"main": [
[
{
"node": "7669d1df-6225-47aa-841b-c14f48cbd2e3",
"type": "main",
"index": 0
}
]
]
},
"d6769f88-ffc4-4c1d-b8be-082109b12dde": {
"main": [
[
{
"node": "20acb740-7157-4e30-bd4d-04b8663a8f8d",
"type": "main",
"index": 0
}
]
]
}
}
}Häufig gestellte Fragen
Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Experte - DevOps, Multimodales KI
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
Automatisiertes System zur Sicherung von Workflows mit Google Drive, GitHub und Benachrichtigungen
Automatisiertes Arbeitsablauf-Backup-System mit Google Drive, GitHub und Nachrichtenbenachrichtigungen
If
N8n
Set
+
If
N8n
Set
20 NodesKhairul Muhtadin
Content-Erstellung
Alle n8n-Workflows alle 4 Stunden zu Google Drive sichern
Automatisches Backup von Arbeitsabläufen nach Google Drive mit Slack-Benachrichtigungen
N8n
Set
Code
+
N8n
Set
Code
12 NodesMuhammad Omer Fayyaz
DevOps
Fortgeschrittene n8n-Workflows mit GitHub-Synchronisation
Automatisiertes Arbeitsablauf-Backup mit intelligenter Änderungserkennung über GitHub
If
N8n
Set
+
If
N8n
Set
38 NodesMaksym Brashenko
DevOps
GitHub Synchronisations-Dashboard - V2
GitHub-Workflow-Versionskontroll-Dashboard mit Commit-Verlauf und Rollback-Funktion
If
N8n
Set
+
If
N8n
Set
94 NodesEduard
DevOps
Intelligentes Workflow-Wartungssystem
Intelligenter Workflow-Wartungssystem mit KI-Filterung und Google Workspace-Integration
If
N8n
Code
+
If
N8n
Code
42 NodesJimmy Gay
DevOps
✨😃 Automatische Workflow-Sicherung zu Google Drive
✨😃 Automatische Workflow-Backups zu Google Drive
N8n
Set
Code
+
N8n
Set
Code
22 NodesJoseph LePage
Sonstiges
Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes17
Kategorie2
Node-Typen9
Autor
Luca Olovrap
@lucaolovrapExterne Links
Auf n8n.io ansehen →
Diesen Workflow teilen