複数のGmail添付ファイルを取得してGoogle Driveにアップロード

初級

これはBuilding Blocks分野の自動化ワークフローで、3個のノードを含みます。主にFunction, GoogleDrive, GmailTriggerなどのノードを使用。 Gmail から複数の添付ファイルを取得して Google ドライブにアップロード

前提条件
  • Google Drive API認証情報
  • Googleアカウント + Gmail API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "1a23006df50de49624f69e85993be557d137b6efe723a867a7d68a84e0b32704"
  },
  "nodes": [
    {
      "id": "3c7ae816-6ce2-4b6b-893e-75c6b8756555",
      "name": "トリガー - 新着メール",
      "type": "n8n-nodes-base.gmailTrigger",
      "notes": "has:attachment",
      "position": [
        680,
        300
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "q": "has:attachment"
        },
        "options": {
          "downloadAttachments": true
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "b87b2211-03d3-4742-98c9-977ae4a8d581",
      "name": "バイナリデータ出力を添付",
      "type": "n8n-nodes-base.function",
      "position": [
        900,
        300
      ],
      "parameters": {
        "functionCode": "let results = [];\n\nfor (item of items) {\n    for (key of Object.keys(item.binary)) {\n        results.push({\n            json: {\n                fileName: item.binary[key].fileName\n            },\n            binary: {\n                data: item.binary[key],\n            }\n        });\n    }\n}\n\nreturn results;"
      },
      "typeVersion": 1
    },
    {
      "id": "f8e19c97-0983-4365-bc63-179605050ef2",
      "name": "ファイルを google ドライブにアップロード",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1140,
        300
      ],
      "parameters": {
        "name": "={{ $json.fileName.split(\".\")[0] + \"-\" + $('Trigger - New Email').item.json.from.value[0].address + \".\" + $json.fileName.split(\".\")[1]}}",
        "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": "root",
          "cachedResultUrl": "https://drive.google.com/drive",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "typeVersion": 3
    }
  ],
  "pinData": {},
  "connections": {
    "3c7ae816-6ce2-4b6b-893e-75c6b8756555": {
      "main": [
        [
          {
            "node": "b87b2211-03d3-4742-98c9-977ae4a8d581",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b87b2211-03d3-4742-98c9-977ae4a8d581": {
      "main": [
        [
          {
            "node": "f8e19c97-0983-4365-bc63-179605050ef2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

初級 - ビルディングブロック

有料ですか?

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

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

n8n初心者向け、1-5ノードのシンプルなワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34