AutomationFlowsAI & RAG › AI Image Search with Google Sheets & Drive

AI Image Search with Google Sheets & Drive

Original n8n title: Search Images

Search Images. Uses lmChatOpenRouter, googleSheetsTool, executeWorkflowTrigger, agent. Event-driven trigger; 21 nodes.

Event trigger★★★★☆ complexityAI-powered21 nodesOpenRouter ChatGoogle Sheets ToolExecute Workflow TriggerAgentGoogle DriveOutput Parser StructuredTelegram
AI & RAG Trigger: Event Nodes: 21 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Execute Workflow Trigger 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": "Search Images",
  "nodes": [
    {
      "parameters": {
        "model": "openai/gpt-4.1-mini",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        140,
        220
      ],
      "id": "70d2ca3e-70d1-40d7-a840-e57d22fff4ae",
      "name": "GPT 4.1 mini",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1JqOTd49heNBdmrf5hSwxI66X724tspAmSjzWoA6-EU0",
          "mode": "list",
          "cachedResultName": "AI Images Log",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JqOTd49heNBdmrf5hSwxI66X724tspAmSjzWoA6-EU0/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JqOTd49heNBdmrf5hSwxI66X724tspAmSjzWoA6-EU0/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.5,
      "position": [
        260,
        220
      ],
      "id": "1298d3da-7677-4c2b-a817-096cd682d65e",
      "name": "Image Database",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "intent"
            },
            {
              "name": "image"
            },
            {
              "name": "chatID"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -20,
        -40
      ],
      "id": "705b774d-0753-450d-934a-49f3092ec1cf",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Image: {{ $json.image }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=# Overview\nYou are an Image Retrieval Agent. When the user provides a query, your task is to search the \"Image Database\" using the keywords from the query. Locate the most relevant matching image.\n\n## Output\n- Return the name, ID, and the Link of the image\n- If no image is found, output \"Not Found\"\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        260,
        -40
      ],
      "id": "37d763c7-58e8-45cc-bce8-9385ed291c90",
      "name": "Image Search Agent"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "44c36e1d-19e8-4411-bd3d-86c5144ecb14",
              "name": "response",
              "value": "Image wasn't found in the database",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        900,
        -300
      ],
      "id": "f4a3ceff-7d4e-4fdb-920b-7ebe5221f620",
      "name": "Not Found"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "a5a9fd85-2403-423e-92a2-d3ba20db83d9",
              "leftValue": "={{ $('When Executed by Another Workflow').first().json.intent }}",
              "rightValue": "Get",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        920,
        -40
      ],
      "id": "4edde658-5b60-4c18-a6ab-1b57420a8712",
      "name": "Get?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "85e307aa-0bb8-40f1-b62e-5b36c231b0af",
              "leftValue": "={{ $json.output.status }}",
              "rightValue": "Not Found",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        660,
        -40
      ],
      "id": "ab4fc306-1577-4b44-8108-5a0b1ca621ef",
      "name": "Not Found?"
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.output.image_id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1180,
        -40
      ],
      "id": "0c7a6e79-a314-4640-a124-862aaf3c72dd",
      "name": "Download File",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "# Trigger\n",
        "height": 260,
        "width": 260,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -100,
        -120
      ],
      "id": "f6725e4b-64f6-4e5b-b347-c1eb37cdc69b",
      "name": "Sticky Note5",
      "disabled": true
    },
    {
      "parameters": {
        "content": "## Tool & Model",
        "height": 200,
        "width": 280,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        100,
        160
      ],
      "id": "7c8f8fb1-2582-4e2a-8814-e1bf90c9ecea",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "# Image Search\n",
        "height": 260,
        "width": 380,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        180,
        -120
      ],
      "id": "560edc28-d0ab-4a7a-87e3-59c31ed2fca9",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "## Structured Output",
        "height": 200,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        400,
        160
      ],
      "id": "1c0d445d-0fcd-462a-b9ed-c7f8d8954fac",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"image_name\":\"string | null\",\n  \"image_id\": \"string | null\",\n  \"image_link\": \"string | null\",\n  \"status\": \"found | not_found\"\n}\n"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        480,
        220
      ],
      "id": "9b2be5fa-c89e-42ee-8752-4cddf42574a5",
      "name": "Name, ID, & Link"
    },
    {
      "parameters": {
        "content": "# Not Found?",
        "height": 260,
        "width": 260,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        580,
        -120
      ],
      "id": "80f1197c-54f4-4650-a0ff-dbf2bed8a316",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "",
        "height": 200,
        "width": 180,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        860,
        -340
      ],
      "id": "66d7ede7-ea19-444f-8639-57a47a9be5af",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "# Get?",
        "height": 260,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        860,
        -120
      ],
      "id": "6f10b02a-40a5-4d8e-82f5-7c2be288f26b",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "be32fa20-d1e6-4831-a266-5991e5c4eb1e",
              "name": "imageName",
              "value": "={{ $json.output.image_name }}",
              "type": "string"
            },
            {
              "id": "10b5ddb9-a482-46a7-962f-8e18533d90d5",
              "name": "imageID",
              "value": "={{ $json.output.image_id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1160,
        200
      ],
      "id": "a9d4f9bf-fabe-4e69-8221-a6ce792d5965",
      "name": "Edit"
    },
    {
      "parameters": {
        "content": "",
        "height": 200,
        "width": 180,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1120,
        160
      ],
      "id": "0a1b7815-160a-4d67-8b68-e5ae610f4a44",
      "name": "Sticky Note7"
    },
    {
      "parameters": {
        "content": "# Send Content",
        "height": 260,
        "width": 280,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1360,
        -120
      ],
      "id": "88381179-5443-4035-9b42-4618cdc6b3af",
      "name": "Sticky Note8"
    },
    {
      "parameters": {
        "content": "# Download\n",
        "height": 260,
        "width": 220,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1120,
        -120
      ],
      "id": "da8d2d2e-f9a9-4554-94bf-e1f13bc454ce",
      "name": "Sticky Note9"
    },
    {
      "parameters": {
        "operation": "sendPhoto",
        "chatId": "={{ $('When Executed by Another Workflow').item.json.chatID }}",
        "binaryData": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1440,
        -40
      ],
      "id": "e6e4e239-cdd9-4f98-a60e-a45e0537045b",
      "name": "Send Photo",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "GPT 4.1 mini": {
      "ai_languageModel": [
        [
          {
            "node": "Image Search Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Image Database": {
      "ai_tool": [
        [
          {
            "node": "Image Search Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Image Search Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Search Agent": {
      "main": [
        [
          {
            "node": "Not Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Not Found?": {
      "main": [
        [
          {
            "node": "Not Found",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get?": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Send Photo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Name, ID, & Link": {
      "ai_outputParser": [
        [
          {
            "node": "Image Search Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "85581b25-b7cf-4ad3-a4dd-1d9aba3488e1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "zDYAKGCIEChJa1JH",
  "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

How this works

Easily discover and retrieve relevant images from your organised Google Sheets database without manual searching, saving hours of sifting through files and ensuring you always access the right visuals for your projects. This workflow suits content creators, marketers, or teams managing image libraries who need quick, precise searches integrated with AI assistance. The core step involves an AI agent powered by lmChatOpenRouter querying your Google Sheets database, then conditionally downloading matches from Google Drive if found.

Use this workflow when handling event-driven image requests in automated systems, such as generating blog visuals or social media assets on demand. Avoid it for real-time, high-volume searches better suited to dedicated image APIs like Google Custom Search, or when your database lacks structured metadata. Common variations include adapting the agent prompt for specific themes, like product photography, or adding output parsing to format results for direct email integration.

About this workflow

Search Images. Uses lmChatOpenRouter, googleSheetsTool, executeWorkflowTrigger, agent. Event-driven trigger; 21 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 contains community nodes that are only compatible with the self-hosted version of n8n.

Output Parser Structured, Telegram, N8N Nodes Tesseractjs +14
AI & RAG

Faceless Video. Uses httpRequest, agent, googleDrive, stickyNote. Event-driven trigger; 29 nodes.

HTTP Request, Agent, Google Drive +6
AI & RAG

Blog Post. Uses toolHttpRequest, lmChatOpenRouter, agent, httpRequest. Event-driven trigger; 20 nodes.

Tool Http Request, OpenRouter Chat, Agent +6
AI & RAG

LinkedIn Post. Uses toolHttpRequest, lmChatOpenRouter, agent, httpRequest. Event-driven trigger; 20 nodes.

Tool Http Request, OpenRouter Chat, Agent +6
AI & RAG

__blog-Post. Uses toolHttpRequest, lmChatOpenRouter, agent, httpRequest. Event-driven trigger; 20 nodes.

Tool Http Request, OpenRouter Chat, Agent +6