Mistral OCRとGmailを使用して工时报表データを抽出・検証

上級

これはContent Creation, Multimodal AI分野の自動化ワークフローで、32個のノードを含みます。主にSet, Code, Gmail, Switch, Aggregateなどのノードを使用。 Mistral OCRとGmailを使って工数票データを抽出し、人間の検証を行う

前提条件
  • Googleアカウント + Gmail API認証情報
  • Google Drive API認証情報
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "d2787088d49a05164783f5a9fa37e1730a27b190e51881d2128ba2bcd8c2656e",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "9e684e57-8185-4cdc-9e50-f04772aebc7a",
      "name": "「Test workflow」クリック時",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1472,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "054e0f32-c0f0-4ce0-bf89-c683a6ec58ae",
      "name": "アイテムをループ処理2",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -976,
        80
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "bfbb9266-7748-42d1-ad5f-ea9fae83cbcf",
      "name": "スプレッドシートファイルを読み込み",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        16,
        112
      ],
      "parameters": {
        "options": {
          "headerRow": true
        }
      },
      "typeVersion": 1
    },
    {
      "id": "629be4ea-76ae-421a-a6f2-c6c7539e7dec",
      "name": "Mistral Cloud Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        1120,
        352
      ],
      "parameters": {
        "model": "mistral-small-latest",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "mRwBaVJZsN6hIzkX",
          "name": "Mistral Cloud account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0e86712-6d3d-4e07-8225-1f073a077f47",
      "name": "ファイルをダウンロード",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -528,
        96
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set File ID1').item.json.file_id }}"
        },
        "options": {
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "text/plain"
            }
          }
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "ukOlw9NKhJMJxRUB",
          "name": "Google Drive account 2"
        }
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "e333ce08-7cef-4c9b-93fd-d52bfe8d23a0",
      "name": "ファイルIDを設定1",
      "type": "n8n-nodes-base.set",
      "position": [
        -752,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "10646eae-ae46-4327-a4dc-9987c2d76173",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "f4536df5-d0b1-4392-bf17-b8137fb31a44",
              "name": "file_type",
              "type": "string",
              "value": "={{ $json.mimeType }}"
            },
            {
              "id": "77d782de-169d-4a46-8a8e-a3831c04d90f",
              "name": "file_title",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "9bde4d7f-e4f3-4ebd-9338-dce1350f9eab",
              "name": "file_url",
              "type": "string",
              "value": "={{ $json.webViewLink }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ce7e73f0-0cb4-4437-b662-012b4434be93",
      "name": "ファイルとフォルダを検索",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1248,
        80
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": ""
          }
        },
        "options": {
          "fields": [
            "id",
            "name",
            "webViewLink",
            "mimeType",
            "*"
          ]
        },
        "resource": "fileFolder",
        "searchMethod": "query"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "ukOlw9NKhJMJxRUB",
          "name": "Google Drive account 2"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "abe728eb-7a64-4fdc-a287-86a35e35fa87",
      "name": "ファイルタイプを切り替え",
      "type": "n8n-nodes-base.switch",
      "position": [
        -304,
        80
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "pdf/doc",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/pdf"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/msword"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/vnd.google-apps.document"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "excel",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/vnd.ms-excel"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "application/vnd.google-apps.spreadsheet"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "image",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "image/jpeg"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "image/png"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "image/tiff"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "image/gif"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.file_type }}",
                    "rightValue": "image/bmp"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": 3
        }
      },
      "typeVersion": 3
    },
    {
      "id": "afe1a432-5596-4b2c-8933-470e256620da",
      "name": "メッセージを送信",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1952,
        112
      ],
      "webhookId": "a53f176d-af13-41b2-9746-51b0136c45f2",
      "parameters": {
        "sendTo": "addemail",
        "message": "=check if give file data match the extracted data\n\n\n {{ $json.email_body }}",
        "options": {},
        "subject": "timesheet approval required",
        "operation": "sendAndWait",
        "formFields": {
          "values": [
            {
              "fieldLabel": "original file ",
              "placeholder": "={{ $('Download File').item.json.file_url }}"
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "is output accurate ",
              "fieldOptions": {
                "values": [
                  {
                    "option": "yes"
                  },
                  {
                    "option": "no"
                  }
                ]
              }
            },
            {
              "fieldLabel": "comments for correction"
            }
          ]
        },
        "responseType": "customForm"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "sKkv4c543Gh7w7yJ",
          "name": "Gmail account 2 rn"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "55f11060-67a1-4388-ad54-a78e3b82fb59",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -32,
        384
      ],
      "parameters": {
        "url": "https://universal-file-to-text-extractor.vercel.app/extract",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "mode",
              "value": "single"
            },
            {
              "name": "output_type",
              "value": "jsonl"
            },
            {
              "name": "files",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            },
            {
              "name": "include_images",
              "value": "true"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "508571a6-e26b-488d-aca5-3792b1eec2ff",
      "name": "フィールドを編集3",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        -176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e5bd95ba-8269-404a-bf9d-fa0d25398b59",
              "name": "",
              "type": "string",
              "value": ""
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "3756f590-1c44-4739-a673-7cba930b5cb9",
      "name": "Mistral アップロード",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160,
        -176
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "purpose",
              "value": "ocr"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "mRwBaVJZsN6hIzkX",
          "name": "Mistral Cloud account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0074468b-7fbb-4590-a8d5-2506f27f7695",
      "name": "Mistral 署名付きURL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        -176
      ],
      "parameters": {
        "url": "=https://api.mistral.ai/v1/files/{{ $json.id }}/url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "expiry",
              "value": "1"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "mRwBaVJZsN6hIzkX",
          "name": "Mistral Cloud account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "82260a41-2b95-46b7-bff2-ccfcab9140ce",
      "name": "Mistral DOC OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        608,
        -176
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"document_url\": \"{{ $json.url }}\"\n  },\n  \"bbox_annotation_format\": {\n    \"type\": \"json_schema\",\n    \"json_schema\": {\n      \"schema\": {\n        \"properties\": {\n          \"image_type\": { \"title\": \"Image_Type\", \"type\": \"string\", \"description\": \"type of image\" },\n          \"short_description\": { \"title\": \"Short_Description\", \"type\": \"string\", \"description\": \"short description\" },\n          \"summary\": { \"title\": \"Summary\", \"type\": \"string\", \"description\": \"summary of the image\" }\n        },\n        \"required\": [\"image_type\",\"short_description\",\"summary\"],\n        \"title\": \"BBOXAnnotation\",\n        \"type\": \"object\",\n        \"additionalProperties\": false\n      },\n      \"name\": \"bbox_annotation\",\n      \"strict\": true\n    }\n  },\n  \"include_image_base64\": false\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "mRwBaVJZsN6hIzkX",
          "name": "Mistral Cloud account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3455c653-2b35-456d-8fb2-d5b99b3f9a9a",
      "name": "集計",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        464,
        112
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "599c0eb8-803e-4450-966e-03672229f4f0",
      "name": "ファイルをアップロード",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2160,
        112
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "ukOlw9NKhJMJxRUB",
          "name": "Google Drive account 2"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "4c96020e-fa32-4c26-bde9-ace0c69175b0",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1312,
        -64
      ],
      "parameters": {
        "color": 4,
        "height": 320,
        "content": "## GET ALL TIMESHEET FROM GOOGLE DRIVE "
      },
      "typeVersion": 1
    },
    {
      "id": "1b74e71a-8bc8-4c40-adf2-26d7633687a6",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -256
      ],
      "parameters": {
        "width": 896,
        "height": 208,
        "content": "## MISTRAL OCR \nfor extraction of data from pdf or doc\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4fe48089-1a95-43ae-8e9a-af3018321acc",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        368
      ],
      "parameters": {
        "width": 1232,
        "content": "## image ocr extraction \n"
      },
      "typeVersion": 1
    },
    {
      "id": "2e823691-2dfc-4761-bb25-d6f4ab7495ab",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        48
      ],
      "parameters": {
        "width": 416,
        "height": 208,
        "content": "## clean and format data into table \n"
      },
      "typeVersion": 1
    },
    {
      "id": "3b3c8a3c-c27d-442f-9351-933c9340244f",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        16
      ],
      "parameters": {
        "width": 288,
        "height": 240,
        "content": "## AI Agent \nto clean and format exctracred data"
      },
      "typeVersion": 1
    },
    {
      "id": "19fa9b90-2692-48c3-b440-acacb9e5b5b5",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        32
      ],
      "parameters": {
        "width": 480,
        "height": 272,
        "content": "## send for verification and wait for response if accepted save to drive"
      },
      "typeVersion": 1
    },
    {
      "id": "896f8922-00ed-4906-8739-c0ff00432441",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        48
      ],
      "parameters": {
        "width": 880,
        "height": 192,
        "content": "## EXCEL EXCTRATOR\nconvert excel to json"
      },
      "typeVersion": 1
    },
    {
      "id": "444cbca3-8ed1-414c-91fc-92ca6ef04a05",
      "name": "付箋7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        0
      ],
      "parameters": {
        "width": 352,
        "height": 256,
        "content": "## DOWNLOAD TIMESHEETS"
      },
      "typeVersion": 1
    },
    {
      "id": "c6b6a8d7-a433-4d56-9bb9-01667580cea2",
      "name": "AIエージェントによる抽出データのクリーニングとフォーマット",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1040,
        128
      ],
      "parameters": {
        "text": "=You must respond ONLY with valid raw rendered JSON.\n- Do NOT include the word \"json\".\n- Do NOT include the word \"```json\".\n- Do NOT use triple backticks or markdown formatting.\n- Do NOT wrap the response in any key like \"output\".\n- Do NOT write anything starting at output directly start with valid root-level JSON.\n- Only respond with a valid, root-level JSON object.\n- Do NOT skip any line item. \n\n\n{{ $json.content }}\n",
        "options": {
          "systemMessage": "=your sole function is to be a meticulous data extraction AI. Your task is to analyze the provided timesheet documents (images, PDFs, etc.) and convert the information into a structured JSON format with absolute precision, following the rules below.\n\n For each timesheet, first extract all summary-level information into the document_info object. This includes the contractor's name, the client or project name, the manager's name (if available), the end date of the timesheet period, and the total hours for the week.\n\n Next, extract each daily work log as an individual item. Process all daily entries sequentially. Each day worked must become a single object in the time_entries list. Ensure all fields for that day (date, day of the week, hours worked, and any description/notes) are correctly populated in its corresponding object.\n\nOutput Format\n\n#You must respond ONLY with valid raw rendered JSON.\n\n-Do NOT include the word \"json\".\n\n-Do NOT include ```json.\n\n-Do NOT use triple backticks or markdown formatting.\n\n-Do NOT wrap the response in any key like \"output\".\n\n-Do NOT write anything before the opening [ of the JSON array.\n\n-Only respond with a valid, root-level JSON array.\n\nDo NOT skip any daily line item. Continue extracting all line items until the sum of all hours_worked values from the time_entries array exactly equals the total_hours value extracted into the document_info object. This verification ensures that all entries are fully extracted and no entries are missed. If the totals do not match, keep parsing and extracting additional line items until they do. Only then stop\noutput format\n\n[\n  {\n    \"document_info\": {\n      \"type\": null,\n      \"date\": null,\n      \"customer_name\": null,\n      \"customer_number\": null,\n      \"supplier_number\": null,\n      \"order_number\": null\n    },\n    \"requested_items\": [\n      {\n        \"pos\": null,\n        \"article_number\": null,\n        \"customer_article_number\": null,\n        \"article_name\": null,\n        \"quantity\": null,\n        \"unit\": null,\n        \"delivery_date\": null\n      }\n    ]\n  }\n]\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "0bd7a945-f240-4d42-8874-05f0d60d1b53",
      "name": "付箋8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -64
      ],
      "parameters": {
        "width": 208,
        "height": 304,
        "content": "## loop over each file"
      },
      "typeVersion": 1
    },
    {
      "id": "ffc35899-5102-48ae-afdb-c025c5e199dd",
      "name": "Excelデータ形式をクリーン化",
      "type": "n8n-nodes-base.code",
      "position": [
        256,
        112
      ],
      "parameters": {
        "jsCode": "// Convert Excel serial date -> YYYY-MM-DD\nconst base = new Date(Date.UTC(1899, 11, 30));\nfunction fromSerial(s) {\n  if (!s || isNaN(Number(s))) return s; // skip if not a number\n  const ms = Number(s) * 86400 * 1000;\n  return new Date(base.getTime() + ms).toISOString().slice(0, 10);\n}\n\nreturn items.map(item => {\n  let row = { ...item.json };\n\n  // Convert possible date fields\n  if (row.__EMPTY && !isNaN(row.__EMPTY)) {\n    row.__EMPTY = fromSerial(row.__EMPTY);\n  }\n  if (row.__EMPTY_1 && !isNaN(row.__EMPTY_1) && row[\" Contractor Timesheet\"]?.includes(\"Weekending\")) {\n    row.__EMPTY_1 = fromSerial(row.__EMPTY_1);\n  }\n\n  return { json: row };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c2cde62a-8f6f-45c5-aa6c-1f8a05a9ddf8",
      "name": "出力を正規化",
      "type": "n8n-nodes-base.set",
      "position": [
        624,
        112
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "530eae36-2bc2-4f6f-8755-73b44da913e4",
              "name": "content",
              "type": "string",
              "value": "={{ $json.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b2247031-284b-4312-9169-9782948610eb",
      "name": "出力を正規化1",
      "type": "n8n-nodes-base.set",
      "position": [
        816,
        -64
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cefc6cbe-dcc3-4cd5-bf3c-735320ece1fe",
              "name": "content",
              "type": "string",
              "value": "={{ $json.pages[0].markdown }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fd2bc3ff-fd6b-49f5-ab9a-6479ea55a565",
      "name": "出力を正規化2",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        368
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cefc6cbe-dcc3-4cd5-bf3c-735320ece1fe",
              "name": "content",
              "type": "string",
              "value": "={{ JSON.parse($json[\"data\"][0]).blocks[0].content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4d85c2d7-a657-42a0-a6ab-c001e8dfd27e",
      "name": "AI出力をクリーン化",
      "type": "n8n-nodes-base.code",
      "position": [
        1392,
        128
      ],
      "parameters": {
        "jsCode": "// input[0].json contains your JSON\nconst outputString = $json[\"output\"];\n\n// Parse the string\nconst parsedJSON = JSON.parse(outputString);\n\n// Return as n8n items\nreturn parsedJSON.map(item => ({ json: item }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "2120ff01-feb7-43fe-ad96-d2dc3c139dbf",
      "name": "json to html",
      "type": "n8n-nodes-base.code",
      "position": [
        1664,
        128
      ],
      "parameters": {
        "jsCode": "const data = $items()[0].json;\n\nlet html = `\n<h2>Timesheet Verification</h2>\n<p>Contractor: ${data.document_info.contractor_name}<br>\nClient: ${data.document_info.client_name}<br>\nManager: ${data.document_info.manager_name}<br>\nEnd Date: ${data.document_info.end_date}<br>\nTotal Hours: ${data.document_info.total_hours}</p>\n\n<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n<tr>\n<th>Day</th>\n<th>Date</th>\n<th>Hours</th>\n<th>Description</th>\n</tr>\n`;\n\ndata.time_entries.forEach(entry => {\n  // Safely handle null or empty description\n  const desc = entry.description ? entry.description.replace(/\\n/g, '<br>') : '';\n  \n  html += `\n<tr>\n<td>${entry.day_of_week}</td>\n<td>${entry.date}</td>\n<td>${entry.hours_worked}</td>\n<td>${desc}</td>\n</tr>`;\n});\n\nhtml += `</table>`;\n\nreturn [{ json: { email_body: html } }];\n"
      },
      "typeVersion": 2
    }
  ],
  "pinData": {},
  "connections": {
    "3455c653-2b35-456d-8fb2-d5b99b3f9a9a": {
      "main": [
        [
          {
            "node": "c2cde62a-8f6f-45c5-aa6c-1f8a05a9ddf8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "508571a6-e26b-488d-aca5-3792b1eec2ff": {
      "main": [
        [
          {
            "node": "3756f590-1c44-4739-a673-7cba930b5cb9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e333ce08-7cef-4c9b-93fd-d52bfe8d23a0": {
      "main": [
        [
          {
            "node": "f0e86712-6d3d-4e07-8225-1f073a077f47",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2120ff01-feb7-43fe-ad96-d2dc3c139dbf": {
      "main": [
        [
          {
            "node": "afe1a432-5596-4b2c-8933-470e256620da",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f0e86712-6d3d-4e07-8225-1f073a077f47": {
      "main": [
        [
          {
            "node": "abe728eb-7a64-4fdc-a287-86a35e35fa87",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "55f11060-67a1-4388-ad54-a78e3b82fb59": {
      "main": [
        [
          {
            "node": "fd2bc3ff-fd6b-49f5-ab9a-6479ea55a565",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3756f590-1c44-4739-a673-7cba930b5cb9": {
      "main": [
        [
          {
            "node": "0074468b-7fbb-4590-a8d5-2506f27f7695",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "afe1a432-5596-4b2c-8933-470e256620da": {
      "main": [
        [
          {
            "node": "054e0f32-c0f0-4ce0-bf89-c683a6ec58ae",
            "type": "main",
            "index": 0
          },
          {
            "node": "599c0eb8-803e-4450-966e-03672229f4f0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "82260a41-2b95-46b7-bff2-ccfcab9140ce": {
      "main": [
        [
          {
            "node": "b2247031-284b-4312-9169-9782948610eb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4d85c2d7-a657-42a0-a6ab-c001e8dfd27e": {
      "main": [
        [
          {
            "node": "2120ff01-feb7-43fe-ad96-d2dc3c139dbf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "054e0f32-c0f0-4ce0-bf89-c683a6ec58ae": {
      "main": [
        [],
        [
          {
            "node": "e333ce08-7cef-4c9b-93fd-d52bfe8d23a0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "abe728eb-7a64-4fdc-a287-86a35e35fa87": {
      "main": [
        [
          {
            "node": "508571a6-e26b-488d-aca5-3792b1eec2ff",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "bfbb9266-7748-42d1-ad5f-ea9fae83cbcf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "55f11060-67a1-4388-ad54-a78e3b82fb59",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c2cde62a-8f6f-45c5-aa6c-1f8a05a9ddf8": {
      "main": [
        [
          {
            "node": "c6b6a8d7-a433-4d56-9bb9-01667580cea2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b2247031-284b-4312-9169-9782948610eb": {
      "main": [
        [
          {
            "node": "c6b6a8d7-a433-4d56-9bb9-01667580cea2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fd2bc3ff-fd6b-49f5-ab9a-6479ea55a565": {
      "main": [
        [
          {
            "node": "c6b6a8d7-a433-4d56-9bb9-01667580cea2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0074468b-7fbb-4590-a8d5-2506f27f7695": {
      "main": [
        [
          {
            "node": "82260a41-2b95-46b7-bff2-ccfcab9140ce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bfbb9266-7748-42d1-ad5f-ea9fae83cbcf": {
      "main": [
        [
          {
            "node": "ffc35899-5102-48ae-afdb-c025c5e199dd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ffc35899-5102-48ae-afdb-c025c5e199dd": {
      "main": [
        [
          {
            "node": "3455c653-2b35-456d-8fb2-d5b99b3f9a9a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ce7e73f0-0cb4-4437-b662-012b4434be93": {
      "main": [
        [
          {
            "node": "054e0f32-c0f0-4ce0-bf89-c683a6ec58ae",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "629be4ea-76ae-421a-a6f2-c6c7539e7dec": {
      "ai_languageModel": [
        [
          {
            "node": "c6b6a8d7-a433-4d56-9bb9-01667580cea2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "9e684e57-8185-4cdc-9e50-f04772aebc7a": {
      "main": [
        [
          {
            "node": "ce7e73f0-0cb4-4437-b662-012b4434be93",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c6b6a8d7-a433-4d56-9bb9-01667580cea2": {
      "main": [
        [
          {
            "node": "4d85c2d7-a657-42a0-a6ab-c001e8dfd27e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

上級 - コンテンツ作成, マルチモーダルAI

有料ですか?

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

関連ワークフロー

Mistral AIとPollinations.aiを使用してソーシャルメディアキャンペーン画像を生成する
Mistral AI と Pollinations.ai を使用したソーシャル メディア キャンペーン用のグラフィックの生成
Set
Code
Merge
+
Set
Code
Merge
29 ノードRajeet Nair
コンテンツ作成
人間介入型投稿デザイナー(Mistral AI、ImageKit と LinkedIn 公開)
Mistral AI、ImageKit、LinkedIn公開を組み合わせた手動介入投稿デザイナー
S3
Set
Gmail
+
S3
Set
Gmail
25 ノードRajeet Nair
コンテンツ作成
WordPressブログの自動化プロフェッショナル版(先端研究)v2.1マーケットプラグイン
GPT-4o、Perplexity AI、そして多言語対応を使ったSEO最適化ブログ作成の自動化
If
Set
Xml
+
If
Set
Xml
125 ノードDaniel Ng
コンテンツ作成
OpenAI、ElevenLabs、Fal.ai を使用した動画・パ odcast・ASM R向けのウイルス性コンテンツ自動作成
OpenAI、ElevenLabs、そして Fal.ai を使って動画、ポッドキャスト、ASMR に向けたウイルスのコンテンツ作成を自動化
Set
Code
Wait
+
Set
Code
Wait
97 ノードAdam Crafts
コンテンツ作成
LinkedInおよびXウイルスのなコンテンツ自動エンジン
AIを使ってLinkedInとXにウイルスのなコンテンツを自動生成して公開する
If
Set
Wait
+
If
Set
Wait
156 ノードDiptamoy Barman
コンテンツ作成
Gemini_NanoBanana_テンプレート
Google SheetsからFal.aiのモデル(nano-banana、WAN2.2、Veo3)でUGC広告生成
If
Set
Code
+
If
Set
Code
36 ノードJaruphat J.
コンテンツ作成
ワークフロー情報
難易度
上級
ノード数32
カテゴリー2
ノードタイプ13
難易度説明

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

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34