This workflow corresponds to n8n.io template #4518 — 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 →
{
"id": "MpylFkqFRYso6hYt",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "AIAutomationPro Restore Credentials From Google Drive",
"tags": [],
"nodes": [
{
"id": "60aa7e22-1d8a-4d93-864a-3f0f4f01418a",
"name": "Convert Files To JSON",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
-40
],
"parameters": {
"options": {},
"operation": "fromJson",
"destinationKey": "=data",
"binaryPropertyName": "=data"
},
"typeVersion": 1
},
{
"id": "6ea6ffa1-ee03-4cb5-ba7a-55c30b5774f1",
"name": "Check For Skipped Credentials",
"type": "n8n-nodes-base.if",
"position": [
1740,
-20
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "ad031296-4ac0-4087-bc35-7975a2cc25e6",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $('Loop Over Items').item.json.name }}",
"rightValue": ""
},
{
"id": "ca912a57-6a4b-4b9a-be0e-37b69d3e4917",
"operator": {
"type": "array",
"operation": "contains",
"rightType": "any"
},
"leftValue": "={{ $('Aggregate Cridentials').first().json.name }}",
"rightValue": "={{ $('Loop Over Items').item.json.name }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "460c8e94-5375-4d26-ac22-12b3fe1bbbd1",
"name": "Restore N8n Credentials",
"type": "n8n-nodes-base.n8n",
"position": [
1960,
0
],
"parameters": {
"data": "={{ JSON.stringify($('Loop Over Items').item.json.data) }}",
"name": "={{ $('Loop Over Items').item.json.name }}",
"resource": "credential",
"requestOptions": {},
"credentialTypeName": "={{ $('Loop Over Items').item.json.type }}"
},
"credentials": {
"n8nApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "70c258f9-91eb-4fae-af40-077e50522452",
"name": "Google Drive Download File",
"type": "n8n-nodes-base.googleDrive",
"position": [
720,
-40
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Google Drive Get Credentials File').first().json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "089faa43-cb45-4daa-baea-770bd82d79fc",
"name": "Google Drive Get Credentials File",
"type": "n8n-nodes-base.googleDrive",
"position": [
520,
-40
],
"parameters": {
"limit": 1,
"filter": {},
"options": {},
"resource": "fileFolder",
"queryString": "n8n_backup_credentials.json"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "254aa95c-cde9-463e-9baa-d2662787a848",
"name": "Execute Command Get All Cridentials",
"type": "n8n-nodes-base.executeCommand",
"position": [
-100,
-40
],
"parameters": {
"command": "npx n8n export:credentials --all --decrypted"
},
"typeVersion": 1
},
{
"id": "59d99f04-3b55-4b7a-b237-c2125933589f",
"name": "JSON Formatting Data",
"type": "n8n-nodes-base.code",
"position": [
100,
-40
],
"parameters": {
"jsCode": "// Function to beautify JSON\nfunction beautifyJson(jsonString) {\n try {\n // Parse the JSON string\n const jsonObject = JSON.parse(jsonString);\n\n // Format the JSON with indentation\n return jsonObject; // Return the parsed object directly\n } catch (error) {\n // Return the error message if JSON is invalid\n return `Invalid JSON: ${error.message}`;\n }\n}\n\n// Retrieve the JSON object from the input data\nconst input = $input.all()[0].json;\n\n// Extract the JSON string from the stdout field\nconst jsonString = input.stdout.match(/\\[{.*}\\]/s);\n\n// Check if a valid JSON string is found\nif (!jsonString) {\n return {\n json: {\n error: \"No valid JSON string found in stdout.\"\n }\n };\n}\n\n// Beautify the JSON\nconst beautifiedJson = beautifyJson(jsonString[0]);\n\n// Output the beautified JSON, ensuring each entry is in an object with a 'json' key\nconst output = beautifiedJson.map(entry => ({ json: entry }));\n\n// Return the output\nreturn output;\n"
},
"typeVersion": 2
},
{
"id": "1a2a5b3f-6440-41d0-b840-ef19540fd2ae",
"name": "Aggregate Cridentials",
"type": "n8n-nodes-base.aggregate",
"position": [
300,
-40
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "name"
}
]
}
},
"typeVersion": 1
},
{
"id": "8d62c789-3bf2-48a7-8ac8-9df721b133d0",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
1120,
-40
],
"parameters": {
"options": {},
"fieldToSplitOut": "=data"
},
"typeVersion": 1
},
{
"id": "f4f6b751-78f9-48b7-9a5d-85466f134556",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1520,
-40
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "ab6eddef-6aaf-4ef8-a3a9-a2a2e3092565",
"name": "Split Out1",
"type": "n8n-nodes-base.splitOut",
"position": [
1320,
-40
],
"parameters": {
"options": {},
"fieldToSplitOut": "data"
},
"typeVersion": 1
},
{
"id": "edd4e9fd-36d9-4572-add7-5fd0d29f4ec8",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-200,
-120
],
"parameters": {
"width": 2591,
"height": 372,
"content": "## Import Credentials To N8n"
},
"typeVersion": 1
},
{
"id": "cb46ba37-1171-488e-a8fc-943e90d5103e",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
2180,
0
],
"parameters": {
"amount": 1
},
"typeVersion": 1.1
},
{
"id": "82a3b7e8-7079-4ef5-bc5c-d9fce0f1c1d7",
"name": "On Click Trigger",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-520,
-40
],
"parameters": {},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "23e5b115-e204-4db0-905e-7d5254b2729a",
"connections": {
"Wait": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Split Out1",
"type": "main",
"index": 0
}
]
]
},
"Split Out1": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Check For Skipped Credentials",
"type": "main",
"index": 0
}
]
]
},
"On Click Trigger": {
"main": [
[
{
"node": "Execute Command Get All Cridentials",
"type": "main",
"index": 0
}
]
]
},
"JSON Formatting Data": {
"main": [
[
{
"node": "Aggregate Cridentials",
"type": "main",
"index": 0
}
]
]
},
"Aggregate Cridentials": {
"main": [
[
{
"node": "Google Drive Get Credentials File",
"type": "main",
"index": 0
}
]
]
},
"Convert Files To JSON": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Restore N8n Credentials": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Google Drive Download File": {
"main": [
[
{
"node": "Convert Files To JSON",
"type": "main",
"index": 0
}
]
]
},
"Check For Skipped Credentials": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
],
[
{
"node": "Restore N8n Credentials",
"type": "main",
"index": 0
}
]
]
},
"Google Drive Get Credentials File": {
"main": [
[
{
"node": "Google Drive Download File",
"type": "main",
"index": 0
}
]
]
},
"Execute Command Get All Cridentials": {
"main": [
[
{
"node": "JSON Formatting 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.
googleDriveOAuth2Apin8nApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n workflow template uses community nodes and is only compatible with the self-hosted version of n8n.
Source: https://n8n.io/workflows/4518/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Self-Hosted n8n Workflow Backup to Google Drive. Uses googleDrive, n8n. Event-driven trigger; 17 nodes.
🎯 Purpose: Generate audio files from text scripts stored in Google Drive.
Restoring multiple n8n workflows manually, especially when migrating your n8n instance to another host or server, can be an incredibly daunting and time-consuming task. Imagine having to individually
Using n8n a lot?
This workflow automatically handles errors in your n8n workflows by: Detecting when an error occurs and capturing the error details Sending an email notification with the error message and affected no