Automatización de asignación aleatoria de tareas domésticas con Google Sheets y notificaciones por Gmail

Intermedio

Este es unautomatización que contiene 15 nodos.Utiliza principalmente nodos como Code, Gmail, GoogleSheets, ScheduleTrigger. Automatizar la asignación aleatoria de tareas domésticas con Google Sheets y notificaciones de Gmail

Requisitos previos
  • Cuenta de Google y credenciales de API de Gmail
  • Credenciales de API de Google Sheets

Categoría

-
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "0867aa2e4fb4e86d170a6ca997a164fd02d27420eb0e7cb54482c4b03d1672ac",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2346a47e-4dc0-4017-83f4-c45098e88319",
      "name": "Disparador programado",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1568,
        -288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ac1a1dc4-ab83-41cc-a4f9-78f200aeb324",
      "name": "Get Tasks",
      "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": "Get People",
      "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": "Send a message",
      "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": "Filtrar Data and Assign Tasks",
      "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": "Update assign_to in sheet",
      "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": "Nota adhesiva1",
      "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": "Nota adhesiva2",
      "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": "Nota adhesiva",
      "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": "Nota adhesiva3",
      "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": "Nota adhesiva5",
      "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": "Nota adhesiva6",
      "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": "Nota adhesiva7",
      "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": "Nota adhesiva8",
      "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": "Nota adhesiva9",
      "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": "Filter Data and Assign Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5870874f-35ce-4b0d-8230-ec7c27fa71eb": {
      "main": [
        [
          {
            "node": "d5692ac3-3119-4466-a557-15bf38acb8c0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "ac1a1dc4-ab83-41cc-a4f9-78f200aeb324",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d5692ac3-3119-4466-a557-15bf38acb8c0": {
      "main": [
        []
      ]
    },
    "Filter Data and Assign Tasks": {
      "main": [
        [
          {
            "node": "5870874f-35ce-4b0d-8230-ec7c27fa71eb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos15
Categoría-
Tipos de nodos5
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
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.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34