{
  "name": "Website Form Leads to Google Sheets",
  "nodes": [
    {
      "id": "n1",
      "name": "Lead form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "formTitle": "Get in touch",
        "formDescription": "Leave your details and we will reply within one business day.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name",
              "requiredField": true
            },
            {
              "fieldLabel": "Email",
              "fieldType": "email",
              "requiredField": true
            },
            {
              "fieldLabel": "Company"
            },
            {
              "fieldLabel": "What do you need help with?",
              "fieldType": "textarea",
              "requiredField": true
            }
          ]
        },
        "options": {
          "respondWithOptions": {
            "values": {
              "formSubmittedText": "Thanks! We will get back to you soon."
            }
          }
        }
      }
    },
    {
      "id": "n2",
      "name": "Clean up fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "Date",
              "value": "={{ $now.toISODate() }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "Name",
              "value": "={{ $json.Name.trim() }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "Email",
              "value": "={{ $json.Email.trim().toLowerCase() }}",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "Company",
              "value": "={{ $json.Company || '' }}",
              "type": "string"
            },
            {
              "id": "a5",
              "name": "Message",
              "value": "={{ $json['What do you need help with?'] }}",
              "type": "string"
            },
            {
              "id": "a6",
              "name": "Status",
              "value": "New",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "n3",
      "name": "Add row to Leads sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        440,
        0
      ],
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {}
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "Google Sheets account"
        }
      }
    },
    {
      "id": "n4",
      "name": "Notify me",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        660,
        0
      ],
      "parameters": {
        "sendTo": "you@example.com",
        "subject": "=New lead: {{ $('Clean up fields').item.json.Name }}",
        "emailType": "text",
        "message": "=Name: {{ $('Clean up fields').item.json.Name }}\nEmail: {{ $('Clean up fields').item.json.Email }}\nCompany: {{ $('Clean up fields').item.json.Company }}\n\n{{ $('Clean up fields').item.json.Message }}",
        "options": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "Gmail account"
        }
      }
    },
    {
      "id": "note",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -340
      ],
      "parameters": {
        "content": "## Setup\n1. Create a Google Sheet with a **Leads** tab and the columns Date, Name, Email, Company, Message, Status.\n2. Paste its URL in **Add row to Leads sheet**.\n3. Connect Google Sheets and Gmail, set your address in **Notify me**.\n4. Activate and share the production form URL.",
        "width": 380,
        "height": 260
      }
    }
  ],
  "connections": {
    "Lead form": {
      "main": [
        [
          {
            "node": "Clean up fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean up fields": {
      "main": [
        [
          {
            "node": "Add row to Leads sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add row to Leads sheet": {
      "main": [
        [
          {
            "node": "Notify me",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}