Gmail添付ファイルをGoogle Driveにバックアップ

中級

これはIT Ops分野の自動化ワークフローで、8個のノードを含みます。主にCode, Gmail, GoogleDrive, GmailTriggerなどのノードを使用。 Gmail添付ファイルをGoogle Driveへバックアップ

前提条件
  • Googleアカウント + Gmail API認証情報
  • Google Drive API認証情報

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "7d8066d2f56a07000fe7d753d3eeabf0ecdf68413466f30d10afe0906f058427",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "9b0e3c5c-6f27-4034-b281-960b039b883a",
      "name": "Gmail トリガー",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -20
      ],
      "parameters": {
        "filters": {
          "sender": "akhilgadiraju@gmail.com"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "wqFUFuFpF5eRAp4E",
          "name": "Gmail OAuth2 - Akhil"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c68ebbfb-8fad-4f2b-837b-fb8ac0ffe4df",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        220,
        -20
      ],
      "webhookId": "2614ede2-d4ce-4490-9792-8157980bece3",
      "parameters": {
        "simple": false,
        "options": {
          "downloadAttachments": true,
          "dataPropertyAttachmentsPrefixName": "attachment_"
        },
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "wqFUFuFpF5eRAp4E",
          "name": "Gmail OAuth2 - Akhil"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "40b97338-6ffe-4cfd-869e-a50815808a89",
      "name": "Replace Me",
      "type": "n8n-nodes-base.noOp",
      "position": [
        800,
        -20
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0d4ae5a5-51d5-4917-8a88-7828d2f0e5ea",
      "name": "Google ドライブ",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        620,
        -20
      ],
      "parameters": {
        "name": "={{ $('Gmail Trigger').item.json.id + \"_\" + $now + \"_\" + \"backup_attachment\" }}",
        "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": "1aZmIqT9jG-GqW_OIGT3HWvRb6JalTlBi",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1aZmIqT9jG-GqW_OIGT3HWvRb6JalTlBi",
          "cachedResultName": "DOcs"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "LxzMJWxwgbnYKUly",
          "name": "Google Drive - Akhil"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "3f2bd52a-7637-4b65-bae3-daebc5f664de",
      "name": "コード",
      "type": "n8n-nodes-base.code",
      "position": [
        420,
        -20
      ],
      "parameters": {
        "jsCode": "return Object.entries(items[0].binary).map(([key, value]) => {\n  return {\n    binary: {\n      data: value\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "c0ae6ad0-7f25-4912-9bbd-7610ef61d6cd",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 260,
        "height": 80,
        "content": "### Change sender filter\nModify the sender field in the Gmail Trigger node"
      },
      "typeVersion": 1
    },
    {
      "id": "0552dd8a-341e-4a67-ad12-8bab41371685",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        140
      ],
      "parameters": {
        "color": 4,
        "height": 180,
        "content": "### Change destination folder \nUpdate folderId in the Google Drive node\n\n### Modify filename format\nEdit the name expression in the Google Drive node"
      },
      "typeVersion": 1
    },
    {
      "id": "f19c4cff-b85d-4ac3-99d7-bf70e61fe5bb",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -140
      ],
      "parameters": {
        "height": 100,
        "content": "### Add post-upload logic\nReplace or extend the Replace Me node with notifications, logs, etc."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c68ebbfb-8fad-4f2b-837b-fb8ac0ffe4df": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "40b97338-6ffe-4cfd-869e-a50815808a89": {
      "main": [
        []
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "40b97338-6ffe-4cfd-869e-a50815808a89",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "c68ebbfb-8fad-4f2b-837b-fb8ac0ffe4df",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - IT運用

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数8
カテゴリー1
ノードタイプ6
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34