非構造化データから構造化データへ

上級

これはDocument Extraction, AI Summarization分野の自動化ワークフローで、16個のノードを含みます。主にDataTable, GmailTrigger, DataTableTool, EmailReadImap, Agentなどのノードを使用。 アクションプラン:メールソースとデータテーブルをOpenAIモデルで処理

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

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "zGGBdrGLXA50cO1A",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "From Unstructured Data To Structured Data",
  "tags": [],
  "nodes": [
    {
      "id": "97cce9f4-cb8e-4ea7-872b-e1f8054afc3a",
      "name": "Gmail トリガー",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -480,
        -224
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "nyuHvSX5HuqfMPlW",
          "name": "Gmail account (n3w.it)"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "13fffb5b-724c-4adf-8c99-5e16f10a5324",
      "name": "OpenAI チャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -112,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "TefveNaDaMERl1hY",
          "name": "OpenAi account (Eure)"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "90d9983b-b4a6-427f-970c-388bae72fb1f",
      "name": "構造化出力パーサー",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        128,
        160
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"from\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"to\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n        \"subject\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n        \"summarize\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1165ea37-01f5-4835-b04d-c91395519e04",
      "name": "OpenAI チャットモデル1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        80,
        336
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "TefveNaDaMERl1hY",
          "name": "OpenAi account (Eure)"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "481c0914-84c3-4c5f-9247-ec709bf18e53",
      "name": "Insert row",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        288,
        -64
      ],
      "parameters": {
        "columns": {
          "value": {
            "To": "={{ $json.output.to }}",
            "From": "={{ $json.output.from }}",
            "Subject": "={{ $json.output.subject }}",
            "Summary": "={{ $json.output.summarize }}"
          },
          "schema": [
            {
              "id": "From",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "From",
              "defaultMatch": false
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false
            },
            {
              "id": "To",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "To",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "LZKeHWCZU60XbKyM",
          "cachedResultUrl": "/projects/mfFxBtuhQcXKlWHw/datatables/LZKeHWCZU60XbKyM",
          "cachedResultName": "Email output parser"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ca682a7e-9630-4c8b-b8eb-17f557354eb8",
      "name": "メールトリガー (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -480,
        -64
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "imap": {
          "id": "k31W9oGddl9pMDy4",
          "name": "IMAP info@n3witalia.com"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "15c2dbd5-6e23-4920-843a-7ce7a43fdcf5",
      "name": "Microsoft Outlook Trigger",
      "type": "n8n-nodes-base.microsoftOutlookTrigger",
      "position": [
        -480,
        80
      ],
      "parameters": {
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "id": "oYlYok8LYOhL04rM",
          "name": "Microsoft Outlook account (dave85heat@hotmail.it)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "04dc1bd7-6ecb-457f-835b-e67b910e30ad",
      "name": "Parsing エージェント",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -64,
        -64
      ],
      "parameters": {
        "text": "={{JSON.stringify($json)}}",
        "options": {
          "systemMessage": "=**Role:**\nYou are a data extraction and parsing agent integrated in an n8n workflow.\n\n**Goal:**\nGiven a JSON input containing one or more emails , your task is to parse and extract structured information from the email content.\n\n**Instructions:**\n\n1. Carefully read the email content provided in the `body` field of the JSON input.\n2. Identify and extract key entities and data points mentioned in the text \n3. Return the extracted data in a **clean, structured JSON format**.\n4. If specific data cannot be found, return the field as `null` instead of omitting it.\n5. Preserve the original structure of the input email list, so that each parsed result corresponds to the same email in the input array.\n6. Do not include any explanations, reasoning, or text outside of JSON.\n\n**Important:**\n\n* Be consistent with field names and data formats (use ISO 8601 for dates, plain strings for text).\n* Never return unstructured text or commentary — only valid JSON.\n* Output should always be a JSON array of parsed objects."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "b0d03646-57f1-4eb0-8f1c-3c27c3900466",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -928
      ],
      "parameters": {
        "color": 3,
        "width": 976,
        "height": 400,
        "content": "## How to Transform Unstructured Email Data into Structured Format Using an AI Agent\n\nThis workflow leverages artificial intelligence to automatically transform **unstructured email data** from multiple sources — including **Gmail**, **Outlook**, and **IMAP** — into **structured** and summarized information.\n\nThe workflow retrieves incoming emails and sends their content to an **AI agent** specifically designed to parse and interpret unstructured text. The agent extracts key metadata and insights from each message, including:\n\n* **From** – the sender’s email address\n* **To** – the recipient’s email address\n* **Subject** – the subject line of the email\n* **Summarize** – a concise summary of the email body generated by the AI\n\nOnce processed, the structured output is stored in a **database table**. This allows for easy indexing, reporting, and integration with other business systems.\n\nBy automating this process, the flow ensures consistent, searchable, and easily digestible information from diverse email sources significantly reducing manual review and improving workflow efficiency."
      },
      "typeVersion": 1
    },
    {
      "id": "17751b90-4db6-45d7-b426-db157e1199db",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -512
      ],
      "parameters": {
        "width": 480,
        "height": 176,
        "content": "## STEP 1\nCreata a n8n table with the following fields:\n- From\n- To\n- Subject\n- Summary"
      },
      "typeVersion": 1
    },
    {
      "id": "fc864e0b-f04e-4996-a012-fbe7ad52dc6b",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -512
      ],
      "parameters": {
        "width": 480,
        "height": 176,
        "content": "## STEP 2\nConnect triggers from different sources:\n- Gmail\n- Outlook\n- Imap"
      },
      "typeVersion": 1
    },
    {
      "id": "ebabb739-ecb9-450b-abb5-1d27d6a95832",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        96
      ],
      "parameters": {
        "width": 272,
        "height": 176,
        "content": "Set the structured data from json"
      },
      "typeVersion": 1
    },
    {
      "id": "84b10b19-a1a2-4fac-b791-8ef5aa1160c6",
      "name": "チャットメッセージ受信時",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        576,
        -64
      ],
      "webhookId": "cd94eebb-fa9b-4b7e-b4ed-09ddfd80fbf0",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "e846ffd6-7ee5-4486-9f6d-a73f349814b9",
      "name": "メール Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        880,
        -64
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant.\n\nUse always the \"Emails\" tool to search for the request."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c833e8c1-68d5-421c-9f71-0d928b14ad19",
      "name": "メールs",
      "type": "n8n-nodes-base.dataTableTool",
      "position": [
        1056,
        160
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "From",
              "keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions0_Value', `Search the emails sent from`, 'string') }}",
              "condition": "ilike"
            },
            {
              "keyName": "Subject",
              "keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions1_Value', `Search the emails with these subject`, 'string') }}",
              "condition": "ilike"
            },
            {
              "keyName": "To",
              "keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions2_Value', `Search the emails sent to`, 'string') }}",
              "condition": "ilike"
            },
            {
              "keyName": "Summary",
              "keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions3_Value', `Search the emails with these summaries`, 'string') }}",
              "condition": "ilike"
            }
          ]
        },
        "operation": "get",
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "LZKeHWCZU60XbKyM",
          "cachedResultUrl": "/projects/mfFxBtuhQcXKlWHw/datatables/LZKeHWCZU60XbKyM",
          "cachedResultName": "Email output parser"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "16feafab-fa9e-4acb-85b5-cd04e6b621d0",
      "name": "Google Gemini チャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        800,
        144
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "0p34rXqIqy8WuoPg",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7527b0d6-cf52-4bd1-81d5-ad39002dda1f",
  "connections": {
    "Emails": {
      "ai_tool": [
        [
          {
            "node": "Email Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Parsing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parsing Agent": {
      "main": [
        [
          {
            "node": "481c0914-84c3-4c5f-9247-ec709bf18e53",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Parsing Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Parsing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Parsing Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "15c2dbd5-6e23-4920-843a-7ce7a43fdcf5": {
      "main": [
        [
          {
            "node": "Parsing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Email Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

上級 - 文書抽出, AI要約

有料ですか?

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

ワークフロー情報
難易度
上級
ノード数16
カテゴリー2
ノードタイプ11
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34