{
  "id": "d7F1dEqCRoIUVdYj",
  "meta": {
    "templateId": "5453",
    "templateCredsSetupCompleted": true
  },
  "name": "Auto Extract Contacts from Business Cards to Sheet With GPT4o",
  "tags": [
    {
      "id": "pg2i0mqcvGPoanrU",
      "name": "Sales Workflow",
      "createdAt": "2025-08-02T06:00:12.615Z",
      "updatedAt": "2025-08-02T06:00:12.615Z"
    }
  ],
  "nodes": [
    {
      "id": "20d8f543-4115-4190-b5f9-ff9ff374a7e9",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2864,
        1216
      ],
      "parameters": {
        "width": 1312,
        "height": 1568,
        "content": "# \ud83d\udcc4 Auto Extract Contacts from Business Cards to Sheet With GPT4o\n\nThis smart workflow extracts names, phone numbers, emails, and more from uploaded name card photos using AI, then logs them neatly into your Google Sheet. No typing. No mess. Just upload and go.\n\n## \ud83d\udc64 Who\u2019s it for\n\n- Sales & Business Development Teams  \n- Recruiters & Talent Acquisition Specialists  \n- Event Teams collecting business cards  \n- Admins who manage contact databases manually  \n\n## \u2699\ufe0f How it works / What it does\n\nThis workflow automates the extraction of contact details from uploaded name card (business card) images and stores them in a structured Google Sheet for easy tracking and follow-up.\n\n### Workflow Steps:\n1. User uploads one or more name card images through a web form.\n2. The uploaded files are saved to a Google Drive folder for archiving.\n3. A smart AI agent (with OCR and GPT capabilities) scans each image and extracts relevant contact data into structured JSON format.\n4. Data is transformed, cleaned (e.g., removing `+` from phone numbers), and filtered.\n5. Valid contacts are appended to a Google Sheet for central tracking and future use.\n\n## \ud83d\udee0 How to set up\n\n1. **Create a Form**  \n   - Allow file upload (JPG/PNG format).\n   - Label it as \u201cName Card Uploader\u201d with a clear description.\n\n2. **Upload to Google Drive**  \n   - Use the Google Drive node to store uploaded images.\n\n3. **Configure Smart Agent**  \n   - Use GPT-4o or similar model with OCR capability.\n   - Apply a structured output parser to extract contact fields like name, phone, email, company, etc.\n\n4. **Transform Data**  \n   - Use the Code node to clean and structure contact info.\n   - Strip out unwanted characters from phone numbers (e.g., `+`).\n\n5. **Filter Invalid Records**  \n   - Remove entries with no meaningful contact data.\n\n6. **Append to Google Sheets**  \n   - Use the Google Sheets node with \"Append Sheet Row\".\n   - Map fields to columns like Name, Phone, Email, etc.\n\n## \u2705 Requirements\n\n- n8n workflow environment  \n- Google Drive integration (for file storage)  \n- Google Sheets integration (for storing contacts)  \n- GPT-4o or any image-capable LLM  \n- Clear name card images (PNG/JPG, readable text)  \n- (Optional) Slack/email integration for notifications\n\n## \ud83e\udde9 How to customize the workflow\n\n- **CRM Sync**: Connect to platforms like HubSpot, Salesforce, or Zoho.  \n- **Validation Logic**: Ensure records contain key fields like name or email before writing.  \n- **Uploader Info**: Attach submitter metadata to each contact record.  \n- **Language Adaptation**: Adjust extracted field labels/output to target your preferred language.  \n- **Batch Upload**: Handle multiple cards in a single image or multiple uploads in one go."
      },
      "typeVersion": 1
    },
    {
      "id": "72a04c4f-59f9-4556-98fc-1c9116be6cc1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        1216
      ],
      "parameters": {
        "width": 540,
        "height": 932,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/namecard.jpg \"Optional title text\")\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f036f0ca-7b80-4573-bdc1-266eb97a8bd5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        1616
      ],
      "parameters": {
        "width": 636,
        "height": 496,
        "content": "## 1.1. Smart agent extract contact from name card picture \n- Sales person upload picture (png/jpg) with multiple name cards (no limit, make sure it clear).\n- Smart agent with OCR capability scan the image and extract all contact and relevant information then transform to well-structure JSON "
      },
      "typeVersion": 1
    },
    {
      "id": "1dd2dc2f-488d-4dce-8c03-e2d508e07ffd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        1648
      ],
      "parameters": {
        "width": 556,
        "height": 304,
        "content": "## 3. Add record to google sheet\n- Client contact has been extracted from name card pictures and save to google drive sheet"
      },
      "typeVersion": 1
    },
    {
      "id": "513be31a-68e9-418c-a328-9ca65cf91df2",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1504,
        1616
      ],
      "parameters": {
        "width": 1020,
        "height": 356,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-02+at+1.28.06%E2%80%AFPM.png \"Optional title text\")"
      },
      "typeVersion": 1
    },
    {
      "id": "156a2e1e-81ab-4650-b6d1-5a289fd4e8dd",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -464,
        1600
      ],
      "parameters": {
        "options": {},
        "formTitle": "Name Card Uploader Form",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "Name Card Picture",
              "multipleFiles": false,
              "acceptFileTypes": ".jpg,.jpge,.png"
            }
          ]
        },
        "formDescription": "Upload a photo of one or more business cards. Our system will automatically extract contact details, such as name, company, phone number, and email, and save them to your team\u2019s Google Sheet for easy access and follow-up."
      },
      "typeVersion": 2.2
    },
    {
      "id": "da4c7125-eb33-4770-a6c0-a797a20117e5",
      "name": "Add contact to tracking sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1088,
        1760
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JobTitle",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "JobTitle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LinkedIn",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "LinkedIn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_AWS_SECRET_KEY_HERE_Pzw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_AWS_SECRET_KEY_HERE_Pzw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_AWS_SECRET_KEY_HERE_Pzw/edit?usp=drivesdk",
          "cachedResultName": "Contacts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "d489224d-5b58-4e43-aa70-11a2d8f1ec76",
      "name": "Transform Output",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        1760
      ],
      "parameters": {
        "jsCode": "const allItems = $input.all();\nlet output = [];\n\nfor (const item of allItems) {\n  const contacts = item.json.output;\n\n  for (const contact of contacts) {\n    const cleanedPhone = contact.phone ? contact.phone.replace(/\\+/g, '') : '';\n    output.push({\n      json: {\n        Name: contact.name || '',\n        JobTitle: contact.job_title || '',\n        Company: contact.company || '',\n        Phone: cleanedPhone || '',\n        Email: contact.email.toLowerCase() || '',\n        Website: contact.website || '',\n        Address: contact.address || '',\n        LinkedIn: contact.linkedin || ''\n      }\n    });\n  }\n}\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "abd70432-b13a-4e20-8ef2-eaa70f59db1d",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        80,
        2064
      ],
      "parameters": {
        "jsonSchemaExample": "[{\n    \"name\": \"John Doe\",\n    \"job_title\": \"Sales Manager\",\n    \"company\": \"TechCorp Inc.\",\n    \"phone\": \"+1234567890\",\n    \"email\": \"user@example.com\",\n    \"website\": \"https://www.techcorp.com\",\n    \"address\": \"123 Market Street, San Francisco, CA\",\n    \"linkedin\": \"https://linkedin.com/in/johndoe\"\n  }]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "4cf62a29-c529-401d-a675-ccda319620d9",
      "name": "GPT4o",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -64,
        2064
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2470ecbd-18a6-4c82-864c-781410922d75",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        1424
      ],
      "parameters": {
        "width": 540,
        "height": 468,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-02+at+1.25.32%E2%80%AFPM.png \"Optional title text\")\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8eaed946-7f53-4f93-82c1-7a709639e62c",
      "name": "Neural assistant for contact extraction",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -96,
        1808
      ],
      "parameters": {
        "text": "=Extract all business contact details from this image of multiple name cards. Return full names, job titles, company names, phone numbers, email addresses, websites, office addresses, and any relevant information such as QR code content or social media links. Do not include decorative elements or branding.",
        "options": {
          "systemMessage": "You are a smart assistant that helps sales and business development teams extract business contact information from images containing multiple business cards. Your role is to analyze the image, detect all individual cards, and extract relevant details such as full name, job title, company name, phone number, email address, website, office address, social media links, and any QR code content. You should skip any decorative or branding elements and focus only on useful business information. Maintain a logical reading order from top to bottom, left to right. Your output will be used by a downstream parser, so return clean, readable text without additional formatting or structure."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "ab5f4a90-be5f-478e-b471-de0f24cae931",
      "name": "Filter bad data",
      "type": "n8n-nodes-base.filter",
      "position": [
        704,
        1760
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "841d0d69-4413-43dd-a48b-034d0f6af183",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Name }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e163856a-b1ee-4d38-af8d-b272b772cddd",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -16,
        1424
      ],
      "parameters": {
        "name": "={{ $now.toFormat(\"yyyyLLdd-HHmmss\") }}-{{$binary.data.fileName}}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1IPcko8bzogO3W4mxhrW2Q017QA0Lc5MI",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1IPcko8bzogO3W4mxhrW2Q017QA0Lc5MI",
          "cachedResultName": "SmartSales"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "d3624f8d-148b-433a-9b84-b613a080f016",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        1376
      ],
      "parameters": {
        "width": 636,
        "height": 208,
        "content": "## 1.2. Upload to Google Drive folder for later process"
      },
      "typeVersion": 1
    },
    {
      "id": "71d1d6e2-e107-4b55-8321-d7aac1930adb",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        1712
      ],
      "parameters": {
        "width": 492,
        "height": 208,
        "content": "## 2. Transform & clean data"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b71fa024-0e46-4615-86b4-8afcc5dddc68",
  "connections": {
    "GPT4o": {
      "ai_languageModel": [
        [
          {
            "node": "Neural assistant for contact extraction",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter bad data": {
      "main": [
        [
          {
            "node": "Add contact to tracking sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform Output": {
      "main": [
        [
          {
            "node": "Filter bad data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Neural assistant for contact extraction",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Neural assistant for contact extraction",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Neural assistant for contact extraction": {
      "main": [
        [
          {
            "node": "Transform Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}