8
n8n 中文网amn8n.com

从Google Sheets自动创建Google Calendar事件

初级

这是一个Other, Support领域的自动化工作流,包含 5 个节点。主要使用 Code, GoogleCalendar, GoogleSheetsTrigger 等节点。 基于Google Sheets数据自动创建Google Calendar事件

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "AvCMhDoSUAYXsrQX",
  "meta": {
    "instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa"
  },
  "name": "从 Google Sheets 自动创建 Google Calendar 事件",
  "tags": [],
  "nodes": [
    {
      "id": "b973046b-ff52-464e-8d34-fe57c5b1df7d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 1200,
        "height": 280,
        "content": "# 从 Google Sheets 自动创建 Google Calendar 事件"
      },
      "typeVersion": 1
    },
    {
      "id": "e845b624-6c0a-4d31-aace-cc050f8613dc",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        300
      ],
      "parameters": {
        "color": 6,
        "width": 1200,
        "height": 280,
        "content": "## 描述"
      },
      "typeVersion": 1
    },
    {
      "id": "60f2c8b8-a953-4fc1-8751-01d8b7924cb2",
      "name": "事件日期格式化器",
      "type": "n8n-nodes-base.code",
      "position": [
        320,
        100
      ],
      "parameters": {
        "jsCode": "// Get the last item from the input data\nconst lastEvent = items[items.length - 1].json;\n\n// Extract relevant fields\nconst eventName = lastEvent[\"Event Name\"];\nconst eventDescription = lastEvent[\"Event Description\"];\nconst currentYear = new Date().getFullYear(); \n// Get the current year\nconst location = lastEvent[\"Location\"];\n\n// Ensure the date includes the year\nconst formatDateWithYear = (dateStr) => {\n    return dateStr.includes(currentYear) ? dateStr : `${dateStr} ${currentYear}`;\n};\n\n// Format the start date\nconst startDateString = formatDateWithYear(lastEvent[\"Event Start Date\"]); // Example: \"11 March 2024\"\n\n// Convert to JavaScript Date object\nconst startDate = new Date(startDateString);\n\n// Convert to ISO format (YYYY-MM-DD)\nconst formattedStartDate = startDate.toISOString().split(\"T\")[0]; // Extract only the date\n\n// Return the last event's formatted data\nreturn [{\n    json: {\n        eventName,\n        eventDescription,\n        startDate: formattedStartDate,\n      location: location,\n    }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e27e0d10-71bb-4d01-ba92-5fb8c3195422",
      "name": "新事件条目监听器",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -120,
        100
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {
          "valueRender": "FORMULA"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            },
            {}
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dKjIGmcnQgSEMVuWAAFVDaj_MCBFKBX8hCOk5OH2dK4/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1dKjIGmcnQgSEMVuWAAFVDaj_MCBFKBX8hCOk5OH2dK4",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dKjIGmcnQgSEMVuWAAFVDaj_MCBFKBX8hCOk5OH2dK4/edit?usp=drivesdk",
          "cachedResultName": "N8n Event List"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "04864602-bf6a-4def-9bc3-c5ab4b5c8336",
      "name": "Google Calendar 事件创建器",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        700,
        100
      ],
      "parameters": {
        "end": "={{ $json.startDate }}",
        "start": "={{ $json.startDate }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": ""
        },
        "additionalFields": {
          "color": "3",
          "allday": "yes",
          "summary": "={{ $json.eventName }}",
          "location": "={{ $json.location }}",
          "showMeAs": "transparent",
          "description": "={{ $json.eventDescription }}",
          "guestsCanInviteOthers": true
        }
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "98bd043e-8dce-4eca-a22f-95ff61f07a1f",
  "connections": {
    "Event Date Formatter": {
      "main": [
        [
          {
            "node": "Google Calendar Event Creator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Event Entry Listener": {
      "main": [
        [
          {
            "node": "Event Date Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

初级 - 其他, 客户支持

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
初级
节点数量5
分类2
节点类型4
难度说明

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
WeblineIndia

WeblineIndia

@weblineindia

A Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.

外部链接
在 n8n.io 查看

分享此工作流