AutomationFlowsGeneral › Automated Backup to Google Drive

Automated Backup to Google Drive

Original n8n title: Backup

backup. Uses googleDrive, httpRequest. Scheduled trigger; 15 nodes.

Cron / scheduled trigger★★★★☆ complexity15 nodesGoogle DriveHTTP Request
General Trigger: Cron / scheduled Nodes: 15 Complexity: ★★★★☆ Added:
Automated Backup to Google Drive — n8n workflow card showing Google Drive, HTTP Request integration

This workflow follows the Google Drive → HTTP Request 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
{
  "active": false,
  "connections": {
    "/": {
      "main": [
        [
          {
            "node": "Globals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "n8n": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "tag?": {
      "main": [
        [
          {
            "node": "/",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Globals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Globals": {
      "main": [
        [
          {
            "node": "Get file data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File": {
      "main": [
        [
          {
            "node": "Merge Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File is new": {
      "main": [
        [
          {
            "node": "Create new file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Items": {
      "main": [
        [
          {
            "node": "isDiffOrNew",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "isDiffOrNew": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status": {
      "main": [
        [
          {
            "node": "Same file - Do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "File is different",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "File is new",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file data": {
      "main": [
        [
          {
            "node": "If file too large",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "n8n",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File is different": {
      "main": [
        [
          {
            "node": "Edit existing file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If file too large": {
      "main": [
        [
          {
            "node": "Get File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit existing file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "n8n",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Same file - Do nothing": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Merge Items",
            "type": "main",
            "index": 1
          },
          {
            "node": "tag?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "createdAt": "2025-07-16T09:39:05.121Z",
  "id": "XDPClTGsdg8nNwmD",
  "isArchived": false,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "backup",
  "nodes": [
    {
      "parameters": {},
      "id": "5e2957df-f798-4a32-8f05-1473e14de86d",
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        720,
        192
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## \u6267\u884c\u5907\u4efd\u5de5\u4f5c\u6d41",
        "height": 751,
        "width": 2587,
        "color": 6
      },
      "id": "46f36edd-0bde-44e8-8b05-ac7bdddef098",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        672
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "id": "9c9eeb46-36f5-4d9d-b570-302201987b7e",
      "name": "n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1024,
        320
      ],
      "typeVersion": 1,
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8d513345-6484-431f-afb7-7cf045c90f4f",
              "name": "Done",
              "type": "boolean",
              "value": true
            }
          ]
        },
        "options": {}
      },
      "id": "170ad499-b50c-441c-a325-f2e5e9f7dadc",
      "name": "Return",
      "type": "n8n-nodes-base.set",
      "position": [
        2384,
        1008
      ],
      "typeVersion": 3.3
    },
    {
      "parameters": {
        "url": "={{ $json.download_url }}",
        "options": {}
      },
      "id": "acc945ee-461b-419b-a398-c434bade7192",
      "name": "Get File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1168,
        768
      ],
      "typeVersion": 4.2
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "45ce825e-9fa6-430c-8931-9aaf22c42585",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.content }}",
              "rightValue": ""
            },
            {
              "id": "9619a55f-7fb1-4f24-b1a7-7aeb82365806",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            }
          ]
        },
        "options": {}
      },
      "id": "12a5338c-84b1-4c6f-9a66-41d1eaec02ad",
      "name": "If file too large",
      "type": "n8n-nodes-base.if",
      "position": [
        960,
        864
      ],
      "typeVersion": 2
    },
    {
      "parameters": {},
      "id": "87d7cba2-d191-422b-a6f3-b1e601017738",
      "name": "Merge Items",
      "type": "n8n-nodes-base.merge",
      "position": [
        1344,
        1024
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "jsCode": "const orderJsonKeys = (jsonObj) => {\n  const ordered = {};\n  Object.keys(jsonObj).sort().forEach(key => {\n    ordered[key] = jsonObj[key];\n  });\n  return ordered;\n}\n\n// Check if file returned with content\nif (Object.keys($input.all()[0].json).includes(\"content\")) {\n  // Decode base64 content and parse JSON\n  const origWorkflow = JSON.parse(Buffer.from($input.all()[0].json.content, 'base64').toString());\n  const n8nWorkflow = $input.all()[1].json;\n  \n  // Order JSON objects\n  const orderedOriginal = orderJsonKeys(origWorkflow);\n  const orderedActual = orderJsonKeys(n8nWorkflow);\n\n  // Determine difference\n  if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n    $input.all()[0].json.github_status = \"same\";\n  } else {\n    $input.all()[0].json.github_status = \"different\";\n    $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n  }\n  $input.all()[0].json.content_decoded = orderedOriginal;\n// No file returned / new workflow\n} else if (Object.keys($input.all()[0].json).includes(\"data\")) {\n  const origWorkflow = JSON.parse($input.all()[0].json.data);\n  const n8nWorkflow = $input.all()[1].json;\n  \n  // Order JSON objects\n  const orderedOriginal = orderJsonKeys(origWorkflow);\n  const orderedActual = orderJsonKeys(n8nWorkflow);\n\n  // Determine difference\n  if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n    $input.all()[0].json.github_status = \"same\";\n  } else {\n    $input.all()[0].json.github_status = \"different\";\n    $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n  }\n  $input.all()[0].json.content_decoded = orderedOriginal;\n\n} else {\n  // Order JSON object\n  const n8nWorkflow = $input.all()[1].json;\n  const orderedActual = orderJsonKeys(n8nWorkflow);\n  \n  // Proper formatting\n  $input.all()[0].json.github_status = \"new\";\n  $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n}\n\n// Return items\nreturn $input.all();"
      },
      "id": "7fa6053a-3d08-4099-8374-33bc55697454",
      "name": "isDiffOrNew",
      "type": "n8n-nodes-base.code",
      "position": [
        1488,
        1024
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "dataType": "string",
        "value1": "={{$json.github_status}}",
        "rules": {
          "rules": [
            {
              "value2": "same"
            },
            {
              "value2": "different",
              "output": 1
            },
            {
              "value2": "new",
              "output": 2
            }
          ]
        }
      },
      "id": "38fa9aea-f7d5-430d-b7b3-78ed1d16bc0d",
      "name": "Check Status",
      "type": "n8n-nodes-base.switch",
      "position": [
        1680,
        992
      ],
      "typeVersion": 1
    },
    {
      "parameters": {},
      "id": "b084ec07-87f9-4c9a-9ae1-0b0b731b4122",
      "name": "Same file - Do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2032,
        816
      ],
      "typeVersion": 1
    },
    {
      "parameters": {},
      "id": "9db86968-825b-4f20-9502-a5966ea32e7e",
      "name": "File is different",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1920,
        1008
      ],
      "typeVersion": 1
    },
    {
      "parameters": {},
      "id": "15161549-8b89-4510-bc0f-5f87ec88f0d2",
      "name": "File is new",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1936,
        1200
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "resource": "file",
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.owner }}"
        },
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.name }}"
        },
        "filePath": "={{ $('Globals').item.json.repo.path }}{{$('Execute Workflow Trigger').first().json.name}}.json",
        "fileContent": "={{$('isDiffOrNew').item.json[\"n8n_data_stringy\"]}}",
        "commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.github_status}})"
      },
      "id": "56f545b3-c2ab-4b13-94e5-c0d86874c908",
      "name": "Create new file",
      "type": "n8n-nodes-base.github",
      "position": [
        2192,
        1200
      ],
      "typeVersion": 1,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "edit",
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.owner }}"
        },
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.name }}"
        },
        "filePath": "={{ $('Globals').item.json.repo.path }}{{$('Execute Workflow Trigger').first().json.name}}.json",
        "fileContent": "={{$('isDiffOrNew').item.json[\"n8n_data_stringy\"]}}",
        "commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.github_status}})"
      },
      "id": "052f43cf-0f6a-41bd-8dcd-d3ce1a1bce7e",
      "name": "Edit existing file",
      "type": "n8n-nodes-base.github",
      "position": [
        2144,
        1008
      ],
      "typeVersion": 1,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "b68c12a6-1aa8-49ef-8f1d-bea6f0a06903",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1264,
        320
      ],
      "typeVersion": 3
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 30
            }
          ]
        }
      },
      "id": "09b69fec-f036-4dbb-a049-0773d7af5c81",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        720,
        400
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "content": "## Backup to GitHub \nThis workflow will backup all instance workflows to GitHub.\n\nThe files are saved `ID.json` for the filename.\n\n### Setup\nOpen `Globals` node and update the values below \ud83d\udc47\n\n- **repo.owner:** your Github username\n- **repo.name:** the name of your repository\n- **repo.path:** the folder to use within the repository. If it doesn't exist it will be created.\n\n\nIf your username was `john-doe` and your repository was called `n8n-backups` and you wanted the workflows to go into a `workflows` folder you would set:\n\n- repo.owner - john-doe\n- repo.name - n8n-backups\n- repo.path - workflows/\n\n\nThe workflow calls itself using a subworkflow, to help reduce memory usage.",
        "height": 621,
        "width": 411,
        "color": 4
      },
      "id": "423ec9ea-4ee4-4329-a912-bfe9a3d6abc8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "get",
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.repo.owner }}"
        },
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.repo.name }}"
        },
        "filePath": "={{ $json.repo.path }}{{ $('Execute Workflow Trigger').item.json.name }}.json",
        "asBinaryProperty": false,
        "additionalParameters": {}
      },
      "id": "a3f33bc4-564b-4f02-a44a-91a87ee7d14b",
      "name": "Get file data",
      "type": "n8n-nodes-base.github",
      "position": [
        752,
        864
      ],
      "typeVersion": 1,
      "alwaysOutputData": true,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "continueOnFail": true
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6cf546c5-5737-4dbd-851b-17d68e0a3780",
              "name": "repo.owner",
              "type": "string",
              "value": "blueskyxi3"
            },
            {
              "id": "452efa28-2dc6-4ea3-a7a2-c35d100d0382",
              "name": "repo.name",
              "type": "string",
              "value": "n8n-workflow-backup"
            },
            {
              "id": "81c4dc54-86bf-4432-a23f-22c7ea831e74",
              "name": "repo.path",
              "type": "string",
              "value": "=workflows/{{ $json.tags[0].name }}"
            }
          ]
        },
        "options": {}
      },
      "id": "f90739e1-de0b-433d-8686-a860694ef710",
      "name": "Globals",
      "type": "n8n-nodes-base.set",
      "position": [
        576,
        864
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "content": "## Edit this node \ud83d\udc47",
        "height": 80,
        "width": 150,
        "color": 4
      },
      "id": "92b31d73-e068-4400-96f3-8e3f6c85089b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        784
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "id": "4c4bae2e-19fd-4835-b14b-791abf4d23f4",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        80,
        1040
      ],
      "typeVersion": 1.1
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "mode": "each",
        "options": {}
      },
      "id": "b53be331-eb87-4699-8ef1-82d374867068",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1584,
        336
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "12cad226-e091-4bbb-aed9-a8e01311772c",
              "name": "tags[0].name",
              "type": "string",
              "value": "={{ $('Execute Workflow Trigger').item.json.tags[0].name }}/"
            }
          ]
        },
        "options": {}
      },
      "id": "e7edf228-f9b4-4760-acc3-189604c63932",
      "name": "/",
      "type": "n8n-nodes-base.set",
      "position": [
        384,
        752
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.tags[0] }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "tag"
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2656fbe3-fe35-4770-9c03-9a455ec618e4",
                    "operator": {
                      "type": "object",
                      "operation": "notExists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.tags[0] }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "none"
            }
          ]
        },
        "options": {}
      },
      "id": "9e49bb54-3295-4b45-86bf-e1a1a1ee7e9b",
      "name": "tag?",
      "type": "n8n-nodes-base.switch",
      "position": [
        208,
        864
      ],
      "typeVersion": 3.2
    },
    {
      "parameters": {
        "content": "## \u5b9a\u65f6\u81ea\u52a8\u5907\u4efd\u5de5\u4f5c\u6d41",
        "height": 520,
        "width": 1960
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        112
      ],
      "typeVersion": 1,
      "id": "85ac9163-bae6-4425-85f8-18c9dac8de1b",
      "name": "Sticky Note2"
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "shared": [
    {
      "updatedAt": "2025-07-16T09:39:05.121Z",
      "createdAt": "2025-07-16T09:39:05.121Z",
      "role": "workflow:owner",
      "workflowId": "XDPClTGsdg8nNwmD",
      "projectId": "AjKOXkiVfZaaIF4c"
    }
  ],
  "staticData": null,
  "tags": [
    {
      "updatedAt": "2025-07-16T09:38:40.625Z",
      "createdAt": "2025-07-16T09:38:40.625Z",
      "id": "ikBNUJURAZVW6saq",
      "name": "backup"
    }
  ],
  "triggerCount": 0,
  "updatedAt": "2025-07-16T12:49:28.376Z",
  "versionId": "ee10d41f-cb6e-478b-b3e2-7d69aa7dc560"
}

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

How this works

Secure your critical files effortlessly with this automated backup solution that safeguards data against loss or corruption, giving you peace of mind for business continuity. Ideal for small business owners, freelancers, or IT administrators managing sensitive documents, it triggers backups on a schedule to Google Drive, ensuring everything from project files to client records is duplicated reliably. The key step involves creating dedicated folders in Google Drive via its integration, followed by targeted file transfers using HTTP requests to pull data from various sources.

Use this workflow when you need consistent, hands-off backups for cloud-stored assets like website content or database exports, particularly if you're handling moderate data volumes without dedicated IT support. Avoid it for massive enterprise-scale storage demands, where specialised tools like AWS Backup might be more efficient, or if real-time syncing is required instead of periodic dumps. Common variations include adjusting the cron schedule for hourly runs or integrating additional HTTP endpoints for backing up from APIs like Slack or Trello.

About this workflow

backup. Uses googleDrive, httpRequest. Scheduled trigger; 15 nodes.

Source: https://github.com/evilasioferreira/n8n-projetos/blob/3b880dcabb148d6d32c4c77e85832c5eab23fde3/templates/gerenciamentoDeBackup/backup.json — 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

Remove Video Background & Compose on Custom Image Background with Google Drive. Uses httpRequest, googleDrive. Webhook trigger; 25 nodes.

HTTP Request, Google Drive
General

Smart google indexing: sitemap filter and url inspection. Uses httpRequest, xml, splitOut, scheduleTrigger. Scheduled trigger; 13 nodes.

HTTP Request, XML
General

Yourang - Complete Workflow Example. Uses n8n-nodes-yourang, httpRequest. Scheduled trigger; 10 nodes.

N8N Nodes Yourang, HTTP Request
General

Automated SEO Indexing via IndexNow & XML Sitemap. Uses scheduleTrigger, httpRequest, xml, splitOut. Scheduled trigger; 9 nodes.

HTTP Request, XML
General

Media Sync (Local HDD → Google Drive). Uses localFileTrigger, readWriteFile, googleDrive, httpRequest. Event-driven trigger; 9 nodes.

Local File Trigger, Read Write File, Google Drive +1