AutomationFlowsEmail & Gmail › Extract Data From Email Attachments to Airtable with Docupipe AI

Extract Data From Email Attachments to Airtable with Docupipe AI

ByUri @docupipe on n8n.io

Teams that receive documents via email and want structured data automatically extracted and saved to an Airtable base for tracking, review, or further automation. Works with any IMAP email provider - Outlook, Yahoo, or custom domains.

Event trigger★★★★☆ complexity12 nodesEmail Read ImapN8N Nodes DocupipeAirtable
Email & Gmail Trigger: Event Nodes: 12 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #14328 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "5035c41c-a247-4078-95d6-f828595fca9a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -260
      ],
      "parameters": {
        "width": 520,
        "height": 1020,
        "content": "## Email to DocuPipe to Airtable\n\nAutomatically extract structured data from email attachments using [DocuPipe](https://docupipe.ai) AI and save results to Airtable. Works with any IMAP email provider (Outlook, Yahoo, custom domains).\n\n### Who is this for?\nTeams that receive documents via email and want structured data automatically extracted and saved to an Airtable base for tracking, review, or further automation.\n\n### How it works\nThis template contains two connected flows:\n\n**Scenario 1 - Upload:** Watches your inbox for new emails with attachments, filters by subject keywords (e.g. invoice, receipt), extracts email metadata, and uploads the attachment to DocuPipe.\n\n**Scenario 2 - Process & Save:** When DocuPipe finishes extracting, the webhook fires, results are fetched, processed into Airtable-compatible format with metadata, and saved as a new record.\n\n### How to set up\n1. Connect your **IMAP email** account (server, port, username, password)\n2. Customize the **subject filter** keywords in the Filter by Subject node\n3. Sign up at [docupipe.ai](https://docupipe.ai), then get your **DocuPipe API key** at [app.docupipe.ai/settings/general](https://app.docupipe.ai/settings/general)\n4. Select an extraction **schema** in the Upload node\n5. Connect your **Airtable** account, select your base and table\n6. Ensure your Airtable column names match the schema field names\n7. Activate this workflow\n\n### Requirements\n- A [DocuPipe](https://docupipe.ai) account with an API key\n- An email account with IMAP access\n- An Airtable account with a table configured for your data\n- An extraction schema configured in DocuPipe\n\n**Note:** Requires the [DocuPipe community node](https://www.npmjs.com/package/n8n-nodes-docupipe). Install via Settings > Community Nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "43a28b75-3b08-44dd-a904-a190680d7a57",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 380,
        "content": "## Scenario 1 - Upload Email Attachments to DocuPipe\nNew emails with attachments are detected via IMAP, filtered by subject keywords (invoice, receipt, etc.), and email metadata is extracted before uploading to DocuPipe. Works with any IMAP email provider - Outlook, Yahoo, or custom domains. The extraction runs asynchronously - results arrive via webhook in Scenario 2."
      },
      "typeVersion": 1
    },
    {
      "id": "f6629173-293f-4e5c-92ff-20af3c14308e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        300
      ],
      "parameters": {
        "color": 7,
        "width": 1420,
        "height": 440,
        "content": "## Scenario 2 - Process Extraction Results & Save to Airtable\nWhen DocuPipe completes extraction, the webhook triggers this flow. The extracted data is fetched, processed into Airtable-compatible format (nested objects and arrays are serialized), enriched with metadata, and saved as a new record in your Airtable base."
      },
      "typeVersion": 1
    },
    {
      "id": "82a7fd41-f989-4625-9697-d784201f709c",
      "name": "New Email with Attachment",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        0,
        60
      ],
      "parameters": {
        "mailbox": "INBOX",
        "options": {
          "downloadAttachments": true
        }
      },
      "credentials": {
        "imap": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ceeb2df9-e9f3-4add-b162-38ec058356ee",
      "name": "Filter by Subject",
      "type": "n8n-nodes-base.if",
      "position": [
        240,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "subject-1",
              "operator": {
                "name": "filter.operator.contains",
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.subject }}",
              "rightValue": "invoice"
            },
            {
              "id": "subject-2",
              "operator": {
                "name": "filter.operator.contains",
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.subject }}",
              "rightValue": "receipt"
            },
            {
              "id": "subject-3",
              "operator": {
                "name": "filter.operator.contains",
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.subject }}",
              "rightValue": "contract"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6fff0198-019c-46c0-a543-99f5cf61dbe2",
      "name": "Extract Email Info",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        60
      ],
      "parameters": {
        "options": {
          "include": "all"
        },
        "assignments": {
          "assignments": [
            {
              "id": "email-1",
              "name": "emailFrom",
              "type": "string",
              "value": "={{ $json.from }}"
            },
            {
              "id": "email-2",
              "name": "emailSubject",
              "type": "string",
              "value": "={{ $json.subject }}"
            },
            {
              "id": "email-3",
              "name": "emailDate",
              "type": "string",
              "value": "={{ $json.date }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e7bc5d8f-1d7a-4473-a007-54e0f7ee6604",
      "name": "Upload Attachment & Extract Data",
      "type": "n8n-nodes-docupipe.docuPipe",
      "position": [
        720,
        60
      ],
      "parameters": {
        "resource": "extraction",
        "schemaId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "inputMode": "binary",
        "operation": "uploadAndExtract",
        "binaryPropertyName": "attachment_0"
      },
      "credentials": {
        "docuPipeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e68250be-109d-488c-b212-d714a236afd7",
      "name": "Extraction Complete",
      "type": "n8n-nodes-docupipe.docuPipeTrigger",
      "position": [
        0,
        480
      ],
      "parameters": {
        "event": "standardization.processed.success"
      },
      "credentials": {
        "docuPipeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f3772d55-4d37-4b7a-8515-20425cf67fea",
      "name": "Get Extracted Data",
      "type": "n8n-nodes-docupipe.docuPipe",
      "position": [
        260,
        480
      ],
      "parameters": {
        "resource": "extraction",
        "operation": "getResult",
        "standardizationId": "={{ $json.standardizationId }}"
      },
      "credentials": {
        "docuPipeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "18ee72c5-b5e4-4f33-ad5a-a688b02dffb1",
      "name": "Process for Airtable",
      "type": "n8n-nodes-base.code",
      "position": [
        520,
        480
      ],
      "parameters": {
        "jsCode": "// Process extraction results into Airtable-compatible format\n// Arrays and nested objects are serialized to strings since Airtable\n// fields expect flat values (text, number, etc.)\nconst data = $input.first().json;\nconst result = data.result || {};\nconst output = {};\n\nfor (const [key, value] of Object.entries(result)) {\n  if (Array.isArray(value)) {\n    // Convert arrays to readable multi-line text\n    output[key] = value.map(item => {\n      if (typeof item === 'object') {\n        return Object.entries(item).map(([k, v]) => `${k}: ${v}`).join(', ');\n      }\n      return String(item);\n    }).join('\\n');\n  } else if (typeof value === 'object' && value !== null) {\n    output[key] = JSON.stringify(value);\n  } else {\n    output[key] = value;\n  }\n}\n\nreturn [{ json: output }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6dc7f0e0-3287-4124-bc0d-33c6975275c2",
      "name": "Add Metadata",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        480
      ],
      "parameters": {
        "options": {
          "include": "all"
        },
        "assignments": {
          "assignments": [
            {
              "id": "meta-1",
              "name": "Document Name",
              "type": "string",
              "value": "={{ $('Get Extracted Data').item.json.documentName }}"
            },
            {
              "id": "meta-2",
              "name": "Extracted At",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c5bb0ea1-39ac-40f6-8c1e-0a3630b0d0df",
      "name": "Create Record in Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1040,
        480
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "columns": {
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "operation": "create",
        "application": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "connections": {
    "Add Metadata": {
      "main": [
        [
          {
            "node": "Create Record in Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Subject": {
      "main": [
        [
          {
            "node": "Extract Email Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Info": {
      "main": [
        [
          {
            "node": "Upload Attachment & Extract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Extracted Data": {
      "main": [
        [
          {
            "node": "Process for Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extraction Complete": {
      "main": [
        [
          {
            "node": "Get Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process for Airtable": {
      "main": [
        [
          {
            "node": "Add Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Email with Attachment": {
      "main": [
        [
          {
            "node": "Filter by Subject",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Teams that receive documents via email and want structured data automatically extracted and saved to an Airtable base for tracking, review, or further automation. Works with any IMAP email provider - Outlook, Yahoo, or custom domains.

Source: https://n8n.io/workflows/14328/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

Email AI Auto-responder. Summerize and send email. Uses emailReadImap, emailSend, httpRequest, googleDrive. Event-driven trigger; 78 nodes.

Email Read Imap, Email Send, HTTP Request +2
Email & Gmail

2025-12-03 fix JS code in node

Gmail, Home Assistant, Gmail Trigger +1
Email & Gmail

Email AI Auto-responder. Summerize and send email. Uses emailReadImap, emailSend, httpRequest, googleDrive. Event-driven trigger; 26 nodes.

Email Read Imap, Email Send, HTTP Request +1
Email & Gmail

Email AI Auto-responder. Summerize and send email. Uses emailReadImap, emailSend, httpRequest, googleDrive. Event-driven trigger; 26 nodes.

Email Read Imap, Email Send, HTTP Request +1
Email & Gmail

How it works

Gmail Trigger, HTTP Request, Airtable