AutomationFlowsAI & RAG › Natural Language Query to Structured Data Retrieval with LLM

Natural Language Query to Structured Data Retrieval with LLM

Natural Language Query to Structured Data Retrieval with LLM. Uses formTrigger, googleGemini. Event-driven trigger; 5 nodes.

Event trigger★★★★☆ complexityAI-powered5 nodesForm TriggerGoogle Gemini
AI & RAG Trigger: Event Nodes: 5 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Form Trigger → Googlegemini recipe pattern — see all workflows that pair these two integrations.

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
{
  "name": "Natural Language Query to Structured Data Retrieval with LLM",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Ask a Question About Your Dataset",
        "formDescription": "Enter your question in natural language (e.g., \"Which students scored more than 80 marks in NLP?\")",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Your Question",
              "fieldType": "textarea",
              "fieldName": "question",
              "placeholder": "e.g., Which students scored more than 80 marks in NLP?",
              "requiredField": true
            },
            {
              "fieldLabel": "Upload Dataset (Excel/CSV)",
              "fieldType": "file",
              "fieldName": "dataset",
              "multipleFiles": false,
              "acceptFileTypes": ".xlsx,.xls,.csv",
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "0e464341-ff06-4c37-9327-afa17cd696b7",
      "name": "Question Form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.5,
      "position": [
        240,
        304
      ]
    },
    {
      "parameters": {
        "operation": "xlsx",
        "binaryPropertyName": "dataset",
        "options": {
          "headerRow": true,
          "includeEmptyCells": false
        }
      },
      "id": "58af128f-5cdd-40c3-8635-053edf9d8305",
      "name": "Load Dataset",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1.1,
      "position": [
        464,
        304
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1",
              "name": "response",
              "value": "={{ $json.content.parts[0].text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "04d2e82c-828a-48ef-8cd3-73073a20f9be",
      "name": "Format Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1248,
        304
      ]
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "=User Question: {{ $(\"Question Form\").item.json.question }}\n\nComplete Dataset:\n{{ JSON.stringify($(\"Load Dataset\").all().slice(0, 50).map(i => i.json), null, 2) }}\n\nPlease analyze the dataset and answer the user's question. Provide a clear, conversational answer with the matching records."
            }
          ]
        },
        "builtInTools": {},
        "options": {
          "systemMessage": "You are a helpful data analyst assistant. Analyze the provided dataset and answer the user's natural language question. Filter and present the relevant records in a clear, conversational format.",
          "maxOutputTokens": 2048,
          "temperature": 0.3
        }
      },
      "id": "558e71fd-a098-4109-b4ff-f67217b45b10",
      "name": "Query Dataset with Gemini",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1.1,
      "position": [
        896,
        304
      ],
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\n\nreturn [$input.all()[0]];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        672,
        304
      ],
      "id": "8a32b47a-4894-4e67-98e5-219b29e05907",
      "name": "Code in JavaScript"
    }
  ],
  "connections": {
    "Question Form": {
      "main": [
        [
          {
            "node": "Load Dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Dataset": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Dataset with Gemini": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Query Dataset with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "5c3d4a51-3b56-4e5b-8225-4d9ed3132ebb",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "aLvRITXk6ZGWq7PC",
  "tags": []
}

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

Natural Language Query to Structured Data Retrieval with LLM. Uses formTrigger, googleGemini. Event-driven trigger; 5 nodes.

Source: https://github.com/abhitrueprogrammer/nlp-tasks/blob/c77c7b64bc7bbe1519d6e06fdf262cd905f9ffc0/n8n/n8n-complex.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

This workflow empowers marketing teams, agencies and solopreneurs to instantly generate on-brand, platform-optimized social media ads — without designers or complex setup. Running performance marketin

Form Trigger, HTTP Request, Slack +1
AI & RAG

Transform any resume into a professional, ATS-compliant document with AI. Supports Global ATS, German, and Japanese resume formats, generates personalized cover letters, and automates PDF creation and

Form Trigger, Google Drive, HTTP Request +3
AI & RAG

[](https://drive.google.com/file/d/1Cl0KwgRgcuBPVdGgL-nqAcheyvfVXttD/view) Click on the image to see the Example output in google drive

HTTP Request, Stop And Error, OpenAI +3
AI & RAG

Perfect for marketing teams, agencies, solopreneurs, and e-commerce brands who need fast, professional-quality ad creatives — without hiring designers or using Canva. This workflow automates image gen

Form Trigger, Google Gemini, Telegram
AI & RAG

This workflow serves as a complete "AI Receptionist" for mortgage brokers or high-ticket service providers. It automates the messy process of qualifying leads, getting internal approval, and collectin

Google Gemini, Gmail, Google Drive +3