AutomationFlowsAI & RAG › Analyze Files with Gemini via Form

Analyze Files with Gemini via Form

Original n8n title: Analyze Files with Gemini

Analyze files with Gemini. Uses formTrigger, httpRequest, gmail. Event-driven trigger; 7 nodes.

Event trigger★★★★☆ complexity7 nodesForm TriggerHTTP RequestGmail
AI & RAG Trigger: Event Nodes: 7 Complexity: ★★★★☆ Added:

This workflow follows the Form Trigger → Gmail 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": "Analyze files with Gemini",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Upload file",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Upload file",
              "fieldType": "file"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        0,
        0
      ],
      "id": "5432899c-333b-40ef-9236-68656d6bb4d2",
      "name": "On form submission"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://generativelanguage.googleapis.com/upload/v1beta/files",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Goog-Upload-Protocol",
              "value": "resumable"
            },
            {
              "name": "X-Goog-Upload-Command",
              "value": "start"
            },
            {
              "name": "X-Goog-Upload-Header-Content-Length",
              "value": "={{ $json['Upload file'][0].size }}"
            },
            {
              "name": "X-Goog-Upload-Header-Content-Type",
              "value": "={{ $json['Upload file'][0].mimetype }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"file\":{\n    \"display_name\":\" {{ $json['Upload file'][0].filename }}\"\n  }\n}",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        0
      ],
      "id": "117b4500-5487-45eb-9aed-d87c0cfe777b",
      "name": "initiateUpload"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('initiateUpload').item.json.headers['x-goog-upload-url'] }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Length",
              "value": "={{ $('On form submission').item.json['Upload file'][0].size }}"
            },
            {
              "name": "X-Goog-Upload-Offset",
              "value": "0"
            },
            {
              "name": "X-Goog-Upload-Command",
              "value": "upload, finalize"
            }
          ]
        },
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "Upload_file",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        0
      ],
      "id": "184b8aa8-e99f-4ea4-a6b1-6b5352c001a2",
      "name": "Upload"
    },
    {
      "parameters": {
        "jsCode": "return{\n  json: {},\n  binary: $('On form submission').item.binary\n}"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        0
      ],
      "id": "025f0dbe-6aeb-4f49-8f78-117e5a93eeaf",
      "name": "Code"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"contents\": [\n        {\n            \"role\": \"user\",\n            \"parts\": [\n                {\n                    \"fileData\": {\n                        \"mimeType\": \"{{ $json.file.mimeType }}\",\n                        \"fileUri\": \"{{ $json.file.uri }}\"\n                    }\n                },\n                {\n                    \"text\": \"Describe\"\n                }\n            ]\n        }\n    ],\n   \"generationConfig\": {\n      \"responseMimeType\": \"application/json\",\n      \"responseSchema\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"videoFormat\": {\n              \"type\": \"string\"\n            },\n            \"Topic\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"videoFormat\",\n            \"Topic\"\n          ]\n        }\n    }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1100,
        0
      ],
      "id": "d9514d86-99ae-4601-b552-aa830d671028",
      "name": "Analyze",
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        880,
        0
      ],
      "id": "d8b287b2-6f70-4142-b750-cbf5e685e195",
      "name": "Wait"
    },
    {
      "parameters": {
        "sendTo": "andrey@magicops.io",
        "subject": "TEST",
        "message": "=Heya! \n<br>\nTopic: \n{{ $json.candidates[0].content.parts[0].text.parseJson().Topic }}\n<br>\nVideo: {{ $json.candidates[0].content.parts[0].text.parseJson().videoFormat }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1320,
        0
      ],
      "id": "ea24220a-7540-4fb6-a1ef-ae7c08a1287e",
      "name": "Gmail",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "initiateUpload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "initiateUpload": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e3d6cb6e-941f-41bd-8648-3f16d63feb28",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "O0QdcCwlrWoNaTLR",
  "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

Analyze files with Gemini. Uses formTrigger, httpRequest, gmail. Event-driven trigger; 7 nodes.

Source: https://github.com/Zie619/n8n-workflows — 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 is ideal for content creators, video marketers, and research professionals who need to extract actionable insights, detailed transcripts, or metadata from YouTube videos efficiently. It

HTTP Request, Google Drive, Gmail +2
AI & RAG

Legal, Procurement, and Compliance teams at mid-size companies. ESN and agencies selling AI-powered contract review as a service.

Form Trigger, HTTP Request, Form +4
AI & RAG

This workflow hosts an n8n intake form, sends submissions to Anthropic Claude for practice-area classification and qualification, then routes results to Gmail and Google Sheets before returning a conf

Form Trigger, HTTP Request, Gmail +2
AI & RAG

This workflow collects SIP and mutual fund details via an n8n Form, calculates goal and performance metrics, generates a personalized advisory using OpenAI, emails a color-coded HTML report via Gmail,

Form Trigger, HTTP Request, Google Sheets +1
AI & RAG

This workflow collects train trip details via an n8n Form, predicts station crowding and queue times with a rule-based algorithm, generates a short advisory with OpenAI, then emails a color-coded HTML

Form Trigger, HTTP Request, Google Sheets +1