Skip to content
agentusehub
Sign in+ Submit
Turn inbound emails into structured lead rows with n8n and an LLM
SalesIntermediateAny

Turn inbound emails into structured lead rows with n8n and an LLM

An n8n workflow watches Gmail, extracts lead fields with an LLM, and appends each lead to a spreadsheet row.

Time saved
0h / week
Setup time
Not stated
Running cost
Not stated
Cost range
Under $25/mo

The problem it solves

“Turn inbound emails into structured lead rows with n8n and an LLM” is an intermediate Sales AI agent workflow from Any. It connects n8n, Gmail, Google Sheets and ChatGPT in 5 steps. Setup takes about Not stated and running costs are about Not stated.

Inbound lead emails arrive as free-form text, so pulling out names, companies, and contact details by hand is slow and inconsistent. A simple automation can extract the fields, but empty values need a deliberate placeholder so deduplication keys stay unique and two different people never collapse into one row.

How it flows
  1. Gmail trigger
  2. LLM extraction
  3. Normalize unknowns
  4. Dedupe check
  5. Append sheet row

Step-by-step setup

  1. Connect the Gmail trigger

    In n8n, add a Gmail trigger node and point it at the inbox or label where inbound lead emails land. Decide whether it polls on a schedule or fires on new mail, and confirm the node outputs the raw message body and sender details for the next step.

  2. Extract fields with an LLM node

    Add an LLM node after the trigger and give it a fixed schema: name, company, email, phone, and any other fields you track. Instruct it to return a single JSON object and to use a specific sentinel such as UNKNOWN for any field the email does not contain, rather than N/A or an empty string.

  3. Normalize and build the dedupe key

    Add a Set or Code node that trims whitespace, lowercases emails, and replaces any missing or blank value with the same UNKNOWN sentinel. Build the dedupe key from the normalized fields so that two leads with different missing data cannot produce identical keys.

  4. Check for duplicates before writing

    Query the target Google Sheet for an existing row matching the dedupe key. If a match exists, route to an update or skip branch; if not, append a new row. Keep the sentinel consistent in the sheet so future runs compare like with like.

  5. Log and review edge cases

    Send rows that contain UNKNOWN in critical fields to a review queue or a separate tab so a human can fill them in. Periodically inspect merged or skipped records to confirm the sentinel logic is holding and adjust the extraction prompt if the model drifts.

Example prompts

Extract lead fields from an email
You are processing an inbound lead email in an n8n workflow. Read the email body below and return one JSON object with the keys name, company, email, phone, and notes. Use the exact string UNKNOWN for any field that is not clearly present in the email; never use N/A, null, an empty string, or a guess. Do not merge information from signatures into the wrong field. Return only the JSON object with no commentary. Email body: [EMAIL BODY].
Build a safe dedupe key
Given the extracted lead JSON below, produce a normalized dedupe key. Lowercase and trim all string values, replace any missing, blank, or placeholder value with the literal token UNKNOWN, then join the values of email, phone, name, and company with pipe characters in that order. Return a JSON object with the fields normalized and a single key field containing the joined string. Do not drop fields that are UNKNOWN, since that would make different leads collide. Input: [EXTRACTED LEAD JSON].

Frequently asked questions

What does the “Turn inbound emails into structured lead rows with n8n and an LLM” workflow do?

An n8n workflow watches Gmail, extracts lead fields with an LLM, and appends each lead to a spreadsheet row.

Which tools do I need?

You need n8n, Gmail, Google Sheets and ChatGPT.

How long does it take to set up?

Plan for about Not stated. It is rated intermediate. The guide walks through 5 steps, starting with “Connect the Gmail trigger”.

How much does it cost to run?

Expect about Not stated in running costs (Under $25/mo range).

What problem does it solve?

Inbound lead emails arrive as free-form text, so pulling out names, companies, and contact details by hand is slow and inconsistent. A simple automation can extract the fields, but empty values need a deliberate placeholder so deduplication keys stay unique and two different people never collapse into one row.

Sales · Beginner
  1. Form submit
  2. Fetch company site
  3. Claude scores fit

Auto-qualify inbound leads before a rep sees them

Score every demo request against your ICP, update HubSpot and ping the right rep in Slack within a minute of the form submit.

n8n · Claude · HubSpot · Slack
Customer Support · Beginner
  1. Support email
  2. Order-status check
  3. Shopify order lookup

Auto-answer order status emails with live tracking

Spot order-status questions in the support inbox, look up the order in Shopify and reply with live tracking and an honest ETA.

Gmail · Zapier · ChatGPT · Shopify
Sales · Intermediate
  1. Meeting in 60 min
  2. Perplexity research
  3. Claude writes brief

Build a pre-call brief for every discovery meeting

An hour before each discovery call, get a one-page brief on the account, the attendee and recent news, saved to Salesforce.

Make · Perplexity · Claude · Salesforce
Add this badge to your site

Built this workflow? Show it is featured on AgentUseHub with a live upvote count that links back here. About badges

Featured on AgentUseHub