Google Drive へのワークフロー バックアップおよび削除のための n8n API とフォームトリガー
中級
これはDevOps分野の自動化ワークフローで、13個のノードを含みます。主にN8n, Code, Telegram, FormTrigger, GoogleDriveなどのノードを使用。 Google Drive への作業フローのバックアップ&削除には n8n API とフォームトリガーを使用
前提条件
- •Telegram Bot Token
- •Google Drive API認証情報
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"meta": {
"instanceId": "0a82a9d5784b67ad963ceff89283b2e40cb771be10fe58ba2682f3598a37c6e1",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "76cdbf3e-e25b-4998-bf56-6cd13140e166",
"name": "フォーム送信時",
"type": "n8n-nodes-base.formTrigger",
"position": [
0,
80
],
"webhookId": "350d8518-e91c-4fd0-af83-b6649e7965bd",
"parameters": {
"options": {
"buttonLabel": "Backup & Delete",
"appendAttribution": false
},
"formTitle": "🧾 Backup & Delete Workflow",
"formFields": {
"values": [
{
"fieldLabel": "Paste the full workflow URL below.",
"placeholder": " https://n8n-miinstancia.com/workflow/abc123",
"requiredField": true
}
]
},
"formDescription": "This tool backs up the full JSON file of a workflow to a Google Drive folder before safely deleting it from your n8n instance."
},
"typeVersion": 2.2
},
{
"id": "10ef7ab2-86ca-4e62-b94f-77a6e18f920d",
"name": "テキストメッセージ送信",
"type": "n8n-nodes-base.telegram",
"position": [
1936,
80
],
"webhookId": "192a1c25-6efc-465a-b77d-c250fee9a57b",
"parameters": {
"text": "=✅ Workflow Backup Successful\n\nThe workflow titled: {{ $json.name }} \nwith ID: {{ $json.id }} \nhas been successfully backed up to your selected Google Drive Folder.\n\n📄 You can view the backup at the following link:\n(USE YOUR GOOGLE DRIVE FOLDER LINK HERE)\n\n📅 Backup Date: {{ $now }}\n",
"chatId": "8019473661",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "BjU1NgO9AIM86N5W",
"name": "EMPTY"
}
},
"typeVersion": 1.2
},
{
"id": "b038653e-afd6-4c59-b291-7caddf8cca7a",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
-768,
-560
],
"parameters": {
"width": 624,
"height": 1360,
"content": "## 🔍 Description:\nEffortlessly delete unused or inactive workflows from your n8n instance while automatically backing them up as .json files into your Google Drive. Keep your instance clean, fast, and organized — no more clutter slowing you down. This workflow is ideal for users managing large self-hosted n8n setups, or anyone who wants to maintain optimal performance while preserving full workflow backups.\n\n## ✅ What it does:\n* Accepts a full n8n Workflow URL via a form\n* Retrieves workflow info automatically\n* Converts the workflow’s full JSON definition into a file\n* Uploads that file to Google Drive\n* Deletes the workflow safely using the official n8n API\n* Sends a Telegram notification confirming backup and deletion\n\n## ⚙️ How it works:\n📝 Form – Collects the full workflow URL from the user\n🔍 n8n Node (Get Workflow) – Uses the URL to fetch workflow details\n📦 Code Node (\"JSON to File\") – Converts the workflow JSON into a properly formatted .json file with UTF-8 encoding, ready to be uploaded to Google Drive.\n☁️ Google Drive Upload – Uploads the .json backup file to your selected Drive folder\n🗑️ n8n Node (Delete Workflow) – Deletes the workflow from your instance using its ID\n📬 Telegram Notification – Notifies you that the workflow was backed up and deleted, showing title, ID, and date\n\n## 📋 Requirements:\n* Google Drive connected to your n8n account\n* Telegram Bot connected to n8n\n* An n8n instance with API access (self-hosted or Cloud)\n* Your n8n API Key (Create one in the settings)\n\n## 🛠️ How to Set Up:\n✅ Add your Google Drive credentials\n✅ Add your Telegram Bot credentials\n\n🧾 In the “JSON to File” Code node, no additional setup is required — it automatically converts the workflow JSON into a downloadable .json file using the correct encoding and filename format.\n\n☁️ In the Google Drive node:\nBinary Property: data\nFolder ID: your target folder in Google Drive\n\n🔑 Create a new credential for the n8n node using:\nAPI Key: your personal n8n API key\nBase URL: your full n8n instance API path (e.g. https://your-n8n-instance.com/api/v1)\n⚙️ Use this credential in both the Get Workflow and Delete Workflow n8n nodes\n\n📬 In the Telegram node, use this message template:\n🗑️ Workflow \"{{ $json.name }}\" (ID: {{ $json.id }}) was backed up to Google Drive and deleted from n8n.\n📅 {{ $now }}\n\n🔒 Important: This workflow backs up the entire workflow data to Google Drive. Please be careful with the permissions of your Google Drive folder and avoid sharing it publicly, as the backups may contain sensitive information. Ensuring proper security and access control is essential to protect your data.\n\n🚀 Activate the workflow and you're ready to safely back up and remove workflows from your n8n instance\n\n"
},
"typeVersion": 1
},
{
"id": "9da23a3f-d899-4eab-a12e-17ff8fa3c816",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📝 1. Form Node: \"Get Workflow URL\"\n\n* Instruction: Ask the user to paste the full workflow URL they want to delete. This URL will be passed to the next node for processing.\n\n* Example input: https://your-n8n-instance/workflow/abcd1234\n\n* [See the Form Submission node documentation.](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.formtrigger/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.formTrigger)\n\n"
},
"typeVersion": 1
},
{
"id": "2ed52c3b-1898-4c06-adc2-d81708ae3679",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
272,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 🔍 2. n8n Node: \"Get Workflow\"\n\n* Instruction: Use the official n8n node with API Key authentication to fetch full workflow details using the ID extracted from the URL.\n\n* Requirement: API Key Auth credentials configured with your API Key and Base URL (e.g., https://your-n8n-instance/api/v1).\n\n* [See the n8n node documentation.](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.n8n/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.n8n)"
},
"typeVersion": 1
},
{
"id": "775f86f7-2daf-45ae-9ab6-0bf6a1ab56ef",
"name": "付箋4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1040,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📁 Google Drive Node: \"Upload Workflow Backup\"\n\nInstruction: Upload the binary file containing the workflow JSON backup to a specified folder in Google Drive. Configure folder ID and file name dynamically if needed.\n\n* [See the Google Drive node documentation.](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googledrive/file-operations/#upload-a-file)"
},
"typeVersion": 1
},
{
"id": "fc18f562-569a-48fa-9faa-14b0dc6349db",
"name": "付箋5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1424,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 🗑️ 5. n8n Node: \"Delete Workflow\"\n\n* Instruction: Delete the workflow from your instance using its ID. Use the same API Key Auth credentials as in step 2.\n\n* [See the n8n node documentation.](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.n8n/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.n8n)"
},
"typeVersion": 1
},
{
"id": "e19ae6be-61e2-414b-af70-2069dc3925a5",
"name": "付箋6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1808,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📬 6. Telegram Node: \"Send Notification\"\n\n* Instruction: Send a Telegram message confirming the workflow was backed up and deleted successfully. Include the workflow name, ID, date, and a link to the backup in Google Sheets.\n\n* [See the Telegram node documentation.](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.telegram/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.telegram)"
},
"typeVersion": 1
},
{
"id": "cbef6523-6186-4a83-b70c-5b3c4a619615",
"name": "ワークフローをアップロード",
"type": "n8n-nodes-base.googleDrive",
"position": [
1168,
80
],
"parameters": {
"name": "={{ $('Get a Workflow').item.json.name }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1Wv8HI8jUu-XbpC4mRJH78WNMAD_xM8f8",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Wv8HI8jUu-XbpC4mRJH78WNMAD_xM8f8",
"cachedResultName": "N8N - Deleted Workflows Backup"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "Ru2YSsIPYQIOlnvD",
"name": "EMPTY"
}
},
"typeVersion": 3
},
{
"id": "e31a574e-a952-43f0-89cc-e385e46f6075",
"name": "付箋7",
"type": "n8n-nodes-base.stickyNote",
"position": [
656,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📦 5. Code Node: \"Generate .json File\"\n\nInstruction: This node converts the workflow JSON into a properly formatted binary file (.json) to upload to Google Drive. It uses the workflow name for the filename and sets the correct MIME type.\n\n* [See the Code node documentation.](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.code)"
},
"typeVersion": 1
},
{
"id": "1b9ef445-9385-4b2c-a0c0-391bb5799887",
"name": "ワークフローを削除",
"type": "n8n-nodes-base.n8n",
"position": [
1568,
80
],
"parameters": {
"operation": "delete",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Get a Workflow').item.json.id }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "VSxAuLMW3kDlXjYA",
"name": "EMPTY"
}
},
"typeVersion": 1
},
{
"id": "5d540bb7-99f0-4202-8eb7-d37200468163",
"name": "ワークフローを取得",
"type": "n8n-nodes-base.n8n",
"position": [
400,
80
],
"parameters": {
"operation": "get",
"workflowId": {
"__rl": true,
"mode": "url",
"value": "={{ $json['Paste the full workflow URL below.'] }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "VSxAuLMW3kDlXjYA",
"name": "EMPTY"
}
},
"typeVersion": 1
},
{
"id": "2da4e84a-20f3-4d3c-905e-eb884218e3b1",
"name": "JSON をファイルに変換",
"type": "n8n-nodes-base.code",
"position": [
784,
80
],
"parameters": {
"jsCode": "const fileName = `${$json.name.replace(/[^a-z0-9_-]/gi, \"_\") || \"workflow\"}.json`;\nconst jsonContent = JSON.stringify($json, null, 2);\n\nreturn [\n {\n binary: {\n data: await this.helpers.prepareBinaryData(Buffer.from(jsonContent), fileName, 'application/json'),\n },\n json: {\n fileName,\n },\n },\n];\n"
},
"typeVersion": 2
}
],
"pinData": {},
"connections": {
"2da4e84a-20f3-4d3c-905e-eb884218e3b1": {
"main": [
[
{
"node": "cbef6523-6186-4a83-b70c-5b3c4a619615",
"type": "main",
"index": 0
}
]
]
},
"5d540bb7-99f0-4202-8eb7-d37200468163": {
"main": [
[
{
"node": "2da4e84a-20f3-4d3c-905e-eb884218e3b1",
"type": "main",
"index": 0
}
]
]
},
"cbef6523-6186-4a83-b70c-5b3c4a619615": {
"main": [
[
{
"node": "1b9ef445-9385-4b2c-a0c0-391bb5799887",
"type": "main",
"index": 0
}
]
]
},
"1b9ef445-9385-4b2c-a0c0-391bb5799887": {
"main": [
[
{
"node": "10ef7ab2-86ca-4e62-b94f-77a6e18f920d",
"type": "main",
"index": 0
}
]
]
},
"76cdbf3e-e25b-4998-bf56-6cd13140e166": {
"main": [
[
{
"node": "5d540bb7-99f0-4202-8eb7-d37200468163",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - DevOps
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
自動化された実行クリーンシステム
n8n APIとカスタムレティンションルールを使用した自動実行クリーンシステム
N8n
Set
Code
+
N8n
Set
Code
12 ノードArlin Perez
DevOps
n8nワークフローBack upと復元
Telegram、Google Drive、フォーム を用いた n8n ワーキ Flore バックアップ&復元
If
N8n
Code
+
If
N8n
Code
28 ノードDaniel Nkencho
高度な n8n ワークフローと GitHub の同期
GitHub による スマートな変更検出を使った ワークフロー バックアップの自動化
If
N8n
Set
+
If
N8n
Set
38 ノードMaksym Brashenko
DevOps
Google Drive へのワークフロー備份とスマートクリーンアップ
Google Drive へのワークフロー バックアップの自動化と スマートなクリーンアップ
N8n
Set
Code
+
N8n
Set
Code
17 ノードLuca Olovrap
DevOps
Telegram-n8n コマンダー
Telegram ボットコマンドによる n8n インスタンスのリモート制御
If
N8n
Set
+
If
N8n
Set
67 ノードArthur Braghetto
DevOps
スマートワークフロー保守システム
スマートAIフィルタリングとGoogle Workspace統合を備えたスマートワークフローメンテナンスシステム
If
N8n
Code
+
If
N8n
Code
42 ノードJimmy Gay
DevOps
ワークフロー情報
難易度
中級
ノード数13
カテゴリー1
ノードタイプ6
作成者
Arlin Perez
@arlindeveloper👋 Hi! I'm Arlin - a QA Engineer with 2 years of experience and a background in Dart & Flutter for mobile app development. ⚙️ I'm passionate about automation and love building efficient workflows using n8n. 📬 Reach out for any help with custom workflows
外部リンク
n8n.ioで表示 →
このワークフローを共有