PDF形式のビジネスドキュメントを自動生成する

中級

これはDocument Extraction分野の自動化ワークフローで、12個のノードを含みます。主にIf, Gmail, Merge, GoogleDrive, HttpRequestなどのノードを使用。 Google Sheets、CraftMyPDF、Drive、Gmail を使ってビジネスドキュメントを生成する

前提条件
  • Googleアカウント + Gmail API認証情報
  • Google Drive API認証情報
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "UJPZC5iE3WG9H1xs",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-Generate Business Documents in PDF",
  "tags": [],
  "nodes": [
    {
      "id": "171902dc-bc1e-41a0-bbde-f9ad294a25a8",
      "name": "ワークフロー実行時",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -440,
        -60
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e506b2b6-4948-4fd5-b292-bb60de3584f6",
      "name": "項目ループ処理",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        80,
        -60
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4621dd93-5acd-4c52-862d-859973a25cf2",
      "name": "従業員データ取得",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -160,
        -60
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "DONE"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit?usp=drivesdk",
          "cachedResultName": " Job Application\tPDFs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6a0caf1d-301e-49fb-8f7a-d902a80b8476",
      "name": "契約書作成",
      "type": "n8n-nodes-craftmypdf.craftMyPdf",
      "position": [
        340,
        -40
      ],
      "parameters": {
        "data": "={\n    \"first_name\": \"{{ $json[\"FIRST NAME\"] }}\",\n    \"last_name\": \"{{ $json[\"LAST NAME\"] }}\",\n    \"address_street1\": \"{{ $json.ADDRESS }}\",\n    \"address_street2\": \"\",\n    \"address_city\": \"{{ $json.CITY }}\",\n    \"address_state\": \"{{ $json.STATE }}\",\n    \"address_postal\": \"{{ $json[\"ZIP CODE\"] }}\",\n    \"address_country\": \"{{ $json.COUNTRY }}\",\n    \"email\": \"{{ $json.EMAIL }}\",\n    \"phone_number\": \"{{ $json.PHONE }}\",\n    \"position\": \"{{ $json.POSITION }}\"\n}",
        "resource": "pdf",
        "templateId": "30c77b239c7aa810"
      },
      "credentials": {
        "craftMyPdfApi": {
          "id": "OvW2Np3Sn8txoAh5",
          "name": "CraftMyPDF account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "35b1c198-c56c-4826-91aa-664686bf3ca0",
      "name": "契約書取得",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        860,
        -60
      ],
      "parameters": {
        "url": "={{ $('Create agreement').item.json.file }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "1a7ce678-eb84-4213-a0ef-539854353e81",
      "name": "契約書アップロード",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        340,
        200
      ],
      "parameters": {
        "name": "={{ $('Get employees').item.json[\"FIRST NAME\"] }}-{{ $('Get employees').item.json[\"LAST NAME\"] }}.pdf",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1dksdhaLr6zt43_cyyLGdHCPsMajAM7FG",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1dksdhaLr6zt43_cyyLGdHCPsMajAM7FG",
          "cachedResultName": "Job Application"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HEy5EuZkgPZVEa9w",
          "name": "Google Drive account (n3w.it)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "0024b884-2bc4-4c53-8d35-db61bb351880",
      "name": "行データ更新",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        860,
        260
      ],
      "parameters": {
        "columns": {
          "value": {
            "DONE": "x",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "FIRST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "FIRST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LAST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "LAST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ADDRESS",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ADDRESS",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CITY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "CITY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "STATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "STATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ZIP CODE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ZIP CODE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "COUNTRY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "COUNTRY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "PHONE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "PHONE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "POSITION",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "POSITION",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "DONE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DONE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "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/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit?usp=drivesdk",
          "cachedResultName": " Job Application\tPDFs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0c6b6f65-5331-4c80-8ad4-1e3d89361ecd",
      "name": "付箋メモ",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -360
      ],
      "parameters": {
        "width": 520,
        "height": 220,
        "content": "## PRELIMINARY STEPS\n\nOnly works with the self-hosted version of n8n\n- Clone this [Sheet](https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit?usp=sharing)\n- Create an account on [CraftMyPDF](https://app.craftmypdf.com/)\n- Create a new PDF template\n- Get the Template ID and insert it in the \"Create aggreement\" node"
      },
      "typeVersion": 1
    },
    {
      "id": "4cea2139-0fd1-4ec0-a48d-5adfcaad268f",
      "name": "成功判定",
      "type": "n8n-nodes-base.if",
      "position": [
        580,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "21203490-bc55-4981-95ed-50674887967b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "success"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0701598a-fdb8-4fd3-8b2d-14487c82bf8c",
      "name": "付箋メモ1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -620
      ],
      "parameters": {
        "color": 3,
        "width": 520,
        "height": 240,
        "content": "## Auto-Generate Business Documents in PDF\n \n\nThis workflow allows you to generate contracts in bulk (job proposals, general documents, pay slips, invoices, contracts, etc.) in PDF format, starting from a Google Sheet containing the data to be inserted.\n\nAfter creating a PDF template (using CraftMyPDF), this workflow manages the entire process, from filling out the PDF files, to sending emails with attachments, to archiving them on Google Drive (or an equivalent system), in a fully automated way."
      },
      "typeVersion": 1
    },
    {
      "id": "34ea77ea-cb4f-4227-be35-da9932f72111",
      "name": "結合処理",
      "type": "n8n-nodes-base.merge",
      "position": [
        580,
        260
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "18541572-a7fb-42b9-91ec-1275fd116ac7",
      "name": "PDFメール送信",
      "type": "n8n-nodes-base.gmail",
      "position": [
        340,
        380
      ],
      "webhookId": "ba0789c5-ed81-4139-a902-4056ab8e1681",
      "parameters": {
        "sendTo": "={{ $('Get employees').item.json.EMAIL }}",
        "message": "=Hi {{ $('Get employees').item.json['FIRST NAME'] }} {{ $('Get employees').item.json['LAST NAME'] }},<br>\nAttached is our job proposal<br><br>\nBest,<br>\n[Company name]",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          },
          "appendAttribution": false
        },
        "subject": "Job offer"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "nyuHvSX5HuqfMPlW",
          "name": "Gmail account (n3w.it)"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "eb1f9c9b-1b50-485e-ab00-ed35e51a9c97",
  "connections": {
    "34ea77ea-cb4f-4227-be35-da9932f72111": {
      "main": [
        [
          {
            "node": "0024b884-2bc4-4c53-8d35-db61bb351880",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4cea2139-0fd1-4ec0-a48d-5adfcaad268f": {
      "main": [
        [
          {
            "node": "35b1c198-c56c-4826-91aa-664686bf3ca0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0024b884-2bc4-4c53-8d35-db61bb351880": {
      "main": [
        [
          {
            "node": "e506b2b6-4948-4fd5-b292-bb60de3584f6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "35b1c198-c56c-4826-91aa-664686bf3ca0": {
      "main": [
        [
          {
            "node": "1a7ce678-eb84-4213-a0ef-539854353e81",
            "type": "main",
            "index": 0
          },
          {
            "node": "18541572-a7fb-42b9-91ec-1275fd116ac7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4621dd93-5acd-4c52-862d-859973a25cf2": {
      "main": [
        [
          {
            "node": "e506b2b6-4948-4fd5-b292-bb60de3584f6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e506b2b6-4948-4fd5-b292-bb60de3584f6": {
      "main": [
        [],
        [
          {
            "node": "6a0caf1d-301e-49fb-8f7a-d902a80b8476",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6a0caf1d-301e-49fb-8f7a-d902a80b8476": {
      "main": [
        [
          {
            "node": "4cea2139-0fd1-4ec0-a48d-5adfcaad268f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1a7ce678-eb84-4213-a0ef-539854353e81": {
      "main": [
        [
          {
            "node": "34ea77ea-cb4f-4227-be35-da9932f72111",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "18541572-a7fb-42b9-91ec-1275fd116ac7": {
      "main": [
        [
          {
            "node": "34ea77ea-cb4f-4227-be35-da9932f72111",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "171902dc-bc1e-41a0-bbde-f9ad294a25a8": {
      "main": [
        [
          {
            "node": "4621dd93-5acd-4c52-862d-859973a25cf2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級 - 文書抽出

有料ですか?

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

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

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

作成者

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