GoogleテーブルとGmail通知を使用してランダムな家務を自動のに割り当て

中級

これは自動化ワークフローで、15個のノードを含みます。主にCode, Gmail, GoogleSheets, ScheduleTriggerなどのノードを使用。 GoogleスプレッドシートとGmail通知を使ったランダムな家務分担の自動化

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

カテゴリー

-
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "0867aa2e4fb4e86d170a6ca997a164fd02d27420eb0e7cb54482c4b03d1672ac",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2346a47e-4dc0-4017-83f4-c45098e88319",
      "name": "スケジュールトリガー",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1568,
        -288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ac1a1dc4-ab83-41cc-a4f9-78f200aeb324",
      "name": "タスクの取得",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1296,
        -288
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit#gid=0",
          "cachedResultName": "Tasks"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit?usp=drivesdk",
          "cachedResultName": "Chore_scheduler"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "x23VLPzDtSY8QGZL",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "cb86134c-7f25-48f2-af87-2297386ca3be",
      "name": "メンバーの取得",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -992,
        -288
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 307557581,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit#gid=307557581",
          "cachedResultName": "Persons"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit?usp=drivesdk",
          "cachedResultName": "Chore_scheduler"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "x23VLPzDtSY8QGZL",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5870874f-35ce-4b0d-8230-ec7c27fa71eb",
      "name": "メッセージの送信",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -384,
        -288
      ],
      "webhookId": "8c1a3396-8d92-419e-ac17-794f5ecbfa98",
      "parameters": {
        "sendTo": "={{ $('Filter Data and Assign Tasks').item.json.email }}",
        "message": "=Hello {{ $('Filter Data and Assign Tasks').item.json.assigned_to }}!\n\nThe homework assigned to you this week is: {{ $('Filter Data and Assign Tasks').item.json.task }}.\n{{ $('Filter Data and Assign Tasks').item.json.description }}\n\nHave a good day!",
        "options": {},
        "subject": "=Task selection"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "Lq6xBv8sVLgAMlGL",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0c83e351-1158-4577-9f24-06297d7477fb",
      "name": "データのフィルタリングとタスク割り当て",
      "type": "n8n-nodes-base.code",
      "position": [
        -688,
        -288
      ],
      "parameters": {
        "jsCode": "let tasks = $items('Get Tasks');\nlet people = $items('Get People');\n\n// Filter persons without Email\npeople = people.filter(item => {\n  const email = item.json.email;\n  return email && email.toString().trim() !== '';\n});\n\n// Filter tasks undefined\ntasks = tasks.filter(item => {\n  const task = item.json.task;\n  return task && task.toString().trim() !== '';\n});\n\n// Error if there aren´t any persons\nif (people.length === 0) {\n  throw new Error('No hay personas con correo electrónico para asignar las tareas.');\n}\n\n// Assign Tasks\nconst assignments = tasks.map((taskItem, index) => {\n  const personItem = people[Math.floor(Math.random() * people.length)];\n  return {\n    json: {\n      row_number: taskItem.json.row_number,\n      task: taskItem.json.task,\n      description: taskItem.json.description,\n      assigned_to: personItem.json.name,\n      email: personItem.json.email,\n    }\n  };\n});\n\nreturn assignments;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d5692ac3-3119-4466-a557-15bf38acb8c0",
      "name": "シート内のassign_toの更新",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -80,
        -288
      ],
      "parameters": {
        "columns": {
          "value": {
            "row_number": "={{ $('Filter Data and Assign Tasks').item.json.row_number }}",
            "assigned_to": "={{ $('Filter Data and Assign Tasks').item.json.assigned_to }}"
          },
          "schema": [
            {
              "id": "task",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "task",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "assigned_to",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "assigned_to",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit#gid=0",
          "cachedResultName": "Tasks"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ghJREX21axnMDVF5tndQMIh6MWYUJevNRV9Ji4kBG7s/edit?usp=drivesdk",
          "cachedResultName": "Chore_scheduler"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "x23VLPzDtSY8QGZL",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "d60ce508-5931-4250-968b-79f1064ed6de",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2000,
        -224
      ],
      "parameters": {
        "color": 2,
        "width": 320,
        "content": "## Sheets Tasks Example\n![](https://i.imgur.com/VHb4GQM.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "17b51b73-044f-4798-a939-fac4daa167df",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2016,
        -672
      ],
      "parameters": {
        "color": 2,
        "width": 352,
        "height": 832,
        "content": "## Setup steps before start\n1.\tSpreadsheet – Create a Google Sheets document with two sheets (“Tasks” and “Persons”) You can see examples in the **images**.\n2.\tCreate your credential for Google Sheets with read and write permissions.\n3. Create your credential to send messages from Gmail.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "97d87ab3-a03d-4522-b516-3bbde84306f3",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1984,
        -448
      ],
      "parameters": {
        "color": 2,
        "width": 288,
        "height": 208,
        "content": "## Sheet Persons ![](https://i.imgur.com/0eN0zPX.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "d8e31fc6-60b1-4ca5-ad1b-70b396bc53e3",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2000,
        -48
      ],
      "parameters": {
        "color": 2,
        "width": 320,
        "height": 192,
        "content": "## How to customise it\n\nChange the schedule interval to suit your rotation, edit the email template to include due dates or motivational messages, or modify the assignment script to weight tasks by difficulty. You could also send notifications via Slack or Telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "289e4235-712e-4b95-bace-0eb749181767",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 352,
        "content": "**Filter Data and Assign Tasks Node (Optional):** \n\nIt's preconfigured but you can or modify the assignment script to weight tasks by difficulty.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ea1dd9bf-3a8c-42cf-b43e-cb5e6fe12d66",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 352,
        "content": "**Send a message node:** \n\nSelect your Gmail credential. If you want you can customise the subject and body of the email."
      },
      "typeVersion": 1
    },
    {
      "id": "ee4d6fb2-e4a4-44c9-9d1a-ea348ec2ca5f",
      "name": "付箋7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 352,
        "content": "**Update sheet assign_to in sheet node:** \n\nThe workflow uses the row_number to match the row being updated. Ensure mapping writes the assigned person’s name to the correct row. "
      },
      "typeVersion": 1
    },
    {
      "id": "75fc9783-7d22-448b-bd52-559f3ec38ca6",
      "name": "付箋8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 352,
        "content": "**Get People Node:** \n\nSelect the credential for your Google account and search for your Persons sheet in drive.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b2b88914-0526-4936-8d5a-b6215dd05eb9",
      "name": "付箋9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 352,
        "content": "**Get Tasks Node:** \n\nSelect the credential for your Google account and search for your Tasks sheet in drive.\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "ac1a1dc4-ab83-41cc-a4f9-78f200aeb324": {
      "main": [
        [
          {
            "node": "cb86134c-7f25-48f2-af87-2297386ca3be",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cb86134c-7f25-48f2-af87-2297386ca3be": {
      "main": [
        [
          {
            "node": "0c83e351-1158-4577-9f24-06297d7477fb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5870874f-35ce-4b0d-8230-ec7c27fa71eb": {
      "main": [
        [
          {
            "node": "d5692ac3-3119-4466-a557-15bf38acb8c0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2346a47e-4dc0-4017-83f4-c45098e88319": {
      "main": [
        [
          {
            "node": "ac1a1dc4-ab83-41cc-a4f9-78f200aeb324",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d5692ac3-3119-4466-a557-15bf38acb8c0": {
      "main": [
        []
      ]
    },
    "0c83e351-1158-4577-9f24-06297d7477fb": {
      "main": [
        [
          {
            "node": "5870874f-35ce-4b0d-8230-ec7c27fa71eb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級

有料ですか?

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

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

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

作成者
Adrian

Adrian

@nafri

Experienced tech professional with 10+ years in Big Data, AI, and automation, former bootcamp director, and passionate about innovation and strategic growth.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34