Vision-Based AI Agent Web Scraper with Google Sheets & Gemini

Overview

This workflow automates the extraction of structured data from webpages using a vision-based AI agent. It combines Google Sheets for managing input URLs and storing results, ScrapingBee for capturing full-page screenshots (and optional HTML fallback), and Google Gemini 1.5 Pro for intelligent data parsing. The AI agent primarily works by analyzing webpage screenshots—making it ideal for dynamic or JavaScript-heavy sites—and falls back to HTML scraping only when the screenshot is insufficient.

This approach is particularly useful for e-commerce scraping, product monitoring, price tracking, or any scenario where you need to extract specific fields (e.g., titles, prices, brands, promotional info) from multiple pages without writing custom selectors.

Workflow Steps

  1. When clicking ‘Test workflow’ — Manual Trigger (No auth)

    • Starts the workflow on demand. Replace this with a scheduled trigger for automation.
  2. Google Sheets – Get list of URLs — Google Sheets (OAuth2 / Service Account)

    • Reads a list of target URLs from a Google Sheet (List of URLs sheet). Configured with a service account credential.
  3. Set fields — Set (No auth)

    • Maps the url field from the sheet row for downstream nodes.
  4. ScrapingBee – Get page screenshot — HTTP Request (API Key auth)

    • Calls ScrapingBee API with api_key, url, and screenshot_full_page=true to capture a full-page screenshot. Also sends a custom User-Agent header.
  5. Vision-based Scraping Agent — AI Agent (No auth)

    • The core node. It receives the screenshot URL (from the screenshot node) and uses the attached LLM and tools to extract data. The system prompt instructs the agent to extract product details from the screenshot and fall back to HTML if needed.
  6. Google Gemini Chat Model — LLM (API Key auth)

    • Powers the vision-based extraction using gemini-1.5-pro-latest. Credentials require a Google AI API key.
  7. HTML-based Scraping Tool — Workflow Tool (No auth)

    • A sub-workflow tool that the agent calls when screenshot extraction is insufficient. It returns HTML content (converted to Markdown) as a fallback.
  8. Structured Output Parser — Output Parser (No auth)

    • Defines a JSON schema for the extracted data (e.g., product_title, product_price, promo, promo_percent). Ensures the agent returns data in a consistent format.
  9. Split Out — Split Out (No auth)

    • Splits the array of extracted products (from the parser) into individual items for the next step.
  10. Google Sheets – Create Rows — Google Sheets (OAuth2 / Service Account)

    • Appends each extracted product as a new row in the Results sheet of the same Google Sheet. Maps fields to columns (product_title, product_price, etc.).
  11. HTML-Scraping Tool (trigger) — Execute Workflow Trigger (No auth)

    • Entry point for the sub-workflow when the agent calls the HTML tool.
  12. Set fields – from AI agent query — Set (No auth)

    • Extracts the url from the agent’s query (the $json.query value).
  13. ScrapingBee- Get page HTML — HTTP Request (API Key auth)

    • Retrieves the raw HTML of the target URL using the same ScrapingBee API key.
  14. HTML to Markdown — Markdown (No auth)

    • Converts the returned HTML to Markdown to reduce token usage when sent back to the agent.

Setup Instructions

  • ScrapingBee: Sign up at scrapingbee.com to get an API key. Insert it in the two HTTP Request nodes (<your_scrapingbee_apikey>).
  • Google Sheets: Use a service account or OAuth2 credential. Create a spreadsheet with two sheets: List of URLs (column A with URLs) and Results (columns matching the output schema). An example sheet is provided.
  • Google Gemini: Obtain an API key from Google AI Studio. Create an API key credential in n8n and connect it to the Gemini node.
  • N8n: Import the workflow, configure credentials for Sheets and Gemini, and replace the placeholder API key in ScrapingBee nodes. Run the workflow to test.

Use Cases & Variations

  • E-commerce scraping: Extract product listings, prices, and promotions from category pages.
  • Competitor monitoring: Regularly scrape competitor websites for pricing changes.
  • Lead generation: Scrape business directories or review sites for contact info.
  • Custom data fields: Modify the Structured Output Parser JSON schema and the Google Sheets columns to extract any visible information (e.g., ratings, descriptions, availability).
  • Scheduled execution: Replace the manual trigger with a Schedule Trigger to run daily or hourly.
  • Multi-page scraping: Adjust the Google Sheets input to include multiple URLs and process them sequentially.
29 nodesmanual triggerAI
HTTP RequestOutput Parser StructuredLm Chat Google GeminiSplit OutGoogle SheetsSticky NoteSetTool Workflow

Workflow JSON

{
  "id": "PpFVCrTiYoa35q1m",
  "meta": {
    "instanceId": "b9faf72fe0d7c3be94b3ebff0778790b50b135c336412d28fd4fca2cbbf8d1f5",
    "templateCredsSetupCompleted": true
  },
  "name": "Vision-Based AI Agent Scraper - with Google Sheets, ScrapingBee, and Gemini",
  "tags": [],
  "nodes": [
    {
      "id": "90ac8845-342e-4fdb-ae09-cb9d169b4119",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        160,
        460
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7a2bfc41-1527-448d-a52c-794ca4c9e7ee",
      "name": "ScrapingBee- Get page HTML",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2280,
        1360
      ],
      "parameters": {
        "url": "https://app.scrapingbee.com/api/v1",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "api_key",
              "value": "<your_scrapingbee_apikey>"
            },
            {
              "name": "url",
              "value": "={{$json.url}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a0ab6dcb-ffad-40bf-8a22-f2e152e69b00",
      "name": "Structured Output Parser",
// ... truncated (copy to see full JSON)

How to Import This Workflow

  1. 1Copy the workflow JSON above using the Copy Workflow JSON button.
  2. 2Open your n8n instance and go to Workflows.
  3. 3Click Import from JSON and paste the copied workflow.

Don't have an n8n instance? Start your free trial at n8nautomation.cloud

Related Templates

Automated Blog Post Creation from News with AI and Blogger

This workflow automates the entire process of creating a fully SEO-optimized blog post from a news article. It fetches a trending technology news headline from Mediastack, generates relevant images from Pexels, uses two AI agents (via OpenRouter) to produce a title, slug, meta description, and a complete WordPress-compatible HTML blog post, then posts it directly to Blogger and sends you a Telegram notification. It's perfect for content marketers, bloggers, or anyone who wants to consistently publish fresh, data-driven content without manual effort. Node Breakdown Schedule Trigger (No auth) — Runs the workflow at a set interval (configured every minute by default, but you should change it to daily or hourly). Mediastack News (API Key auth via query parameter) — Fetches the latest technology news article in English from the Mediastack API. Parameters: set to . Genarate image (API Key auth via header, ) — Searches Pexels for up to 2 images related to the news title. Parameters: = , = 2. Send a text message1 (Telegram bot token auth) — Sends a Telegram message with the generated image URLs to the chat ID stored in . AI Agent (Uses OpenRouter Chat Model — API Key auth) — This agent takes the news title and returns a JSON object with three fields: , , and (meta description). The prompt includes strict guidelines for SEO-friendly output. OpenRouter Chat Model (API Key auth) — The language model for the first AI agent, using . Parsing (No auth) — A Code node that cleans the raw AI output (removes markdown code fences) and parses the JSON into usable fields. Copywriter AI Agent (Uses OpenRouter Chat Model2 — API Key auth) — This agent writes a complete 1,000-word SEO blog post in HTML format. It uses the title, meta, and the two images from Pexels. The prompt is very detailed, specifying structure, keyword placement, and styling. OpenRouter Chat Model2 (API Key auth) — Same model as the first, but used for the second agent. Cleanup HTML (No auth) — A Set node that removes any leftover htmlurlhttps://www.googleapis.com/blogger/v3/blogs/$vars.bloggerid/postsPOSThttpQueryAuthAuthorization$vars.telegramchatid$vars.bloggeridbusinesssports`) to match your niche. Multi-language Support — Modify the Mediastack query to fetch news in other languages, and adjust the AI prompts to write in that language. Custom Image Sources — Replace the Pexels node with another image API (e.g., Unsplash) or use a local image generation model. Different CMS — Swap the Blogger HTTP Request node with WordPress or any other CMS API (just change the URL and body format). Human-in-the-Loop — Add a Slack or email approval step before publishing to review the AI-generated content. Newsletter Integration — Instead of posting to a blog, send the formatted content as an email newsletter via Gmail or SendGrid.

16 nodes

AI Chat Agent with OpenAI, Memory, and Web Search

Overview This workflow creates an intelligent AI chat agent that combines OpenAI's language model with conversational memory and real-time web search capabilities via SerpAPI. It is designed to power interactive chat applications where the AI can remember context across messages and fetch up-to-date information from the internet when needed. This is particularly useful for building customer support bots, research assistants, or any conversational interface that requires both knowledge retention and live data access. The workflow is triggered by incoming chat messages and processes them through an AI agent that coordinates between the language model, memory buffer, and search tool. The agent can decide when to use web search to answer questions that require current information, while maintaining conversation history for coherent multi-turn dialogues. Workflow Steps Manual Trigger (No auth) — This node allows you to manually start the workflow for testing purposes. It has no parameters configured and simply provides a button to execute the workflow on demand. When chat message received (No auth) — This is a webhook-based trigger that listens for incoming chat messages. It generates a unique webhook URL that you can integrate with your chat frontend or messaging platform. The parameter is empty, meaning default webhook behavior is used. AI Agent (No auth) — This is the core orchestrator node that manages the conversation flow. It coordinates between the OpenAI model, memory buffer, and SerpAPI tool. The agent decides which tool to use based on the user's query and maintains the conversation state. OpenAI Chat Model (API Key auth) — This node connects to OpenAI's GPT-4o-mini model to generate responses. It requires an OpenAI API key configured in n8n credentials. The parameter is set to , which is a cost-effective and fast model suitable for chat applications. The parameter is empty, using default model settings. Window Buffer Memory (No auth) — This node implements a sliding window memory that stores recent conversation history. It allows the AI to remember context from previous messages within a configurable window size. The parameters are empty, using default memory settings. SerpAPI (API Key auth) — This tool node enables web search functionality via SerpAPI (Google Search API). It requires a SerpAPI API key configured in n8n credentials. The parameter is empty, using default search settings. The agent calls this node when it determines that real-time web data is needed to answer a query. Setup Instructions To use this workflow, you need the following accounts and credentials: OpenAI Account: Sign up at platform.openai.com and create an API key. In n8n, create an "OpenAI" credential and paste your API key. SerpAPI Account: Register at serpapi.com and obtain an API key. In n8n, create a "SerpAPI" credential with your key. Webhook URL: After activating the workflow, copy the webhook URL from the "When chat message received" node. Integrate this URL into your chat application (e.g., a custom web chat widget, Slack app, or Telegram bot). Optional: Configure the memory window size in the "Window Buffer Memory" node if you want to limit or extend conversation context. Use Cases and Variations This workflow can be adapted for multiple scenarios: Customer Support Bot: Replace SerpAPI with a knowledge base tool (e.g., vector store or database lookup) to answer product-specific questions. Research Assistant: Keep SerpAPI for web search and add additional tools like Wikipedia or news APIs. Multi-Platform Chat: Connect the webhook to different messaging platforms (Slack, Discord, Telegram) by adding appropriate trigger nodes. Personal Assistant: Add calendar or email tools to let the AI manage schedules and send messages. Language Translation: Replace the OpenAI model with a translation-specific model or add a translation tool node. To extend the workflow, you can add more tool nodes (e.g., database queries, file operations) and connect them to the AI Agent. The agent will automatically learn to use new tools based on their descriptions.

6 nodes

AI Social Media Content Generator using Local Ollama

This workflow uses a local Ollama instance to automatically generate platform-specific social media content (Twitter, LinkedIn, Reddit, Instagram) for a given topic, brand voice, and target audience. It then reviews and polishes the content for consistency and quality. Perfect for content creators, marketers, or developers who want to quickly produce multi-platform posts with full control over AI model and data privacy. Workflow Steps Manual Trigger (No auth) — Manually start the workflow to generate content on demand. Content Parameters — A Set node that defines three input variables: , , and . These can be edited directly in the node to customize each generation. Generate All Platform Content (Ollama) — An HTTP Request node (No auth) that sends a prompt to the local Ollama API (). It requests the model () to output structured JSON containing posts for Twitter, LinkedIn, Reddit, and Instagram. Parse Content JSON — A Code node that extracts and parses the JSON response from Ollama, merging it with the original topic and a timestamp. Review & Polish (Ollama) — A second HTTP Request node (No auth) that sends the generated content to Ollama for quality review (grammar, tone, formatting) and returns corrected versions if needed. Final Content Output — A Code node that merges the reviewed output with the original and flags whether the content was reviewed. Setup Instructions Ollama: Download and install Ollama on your local machine. Pull the model by running . Ensure Ollama is running (default on ). n8n: The workflow uses only local connections—no external API keys or accounts required. Simply import the JSON into your n8n instance and execute it manually. Customization: Modify the node to change the topic, brand voice, or target audience. Adjust the prompt in the first HTTP Request node to add or remove platforms. Use Cases & Variations Scheduled content generation: Replace the Manual Trigger with a Cron trigger to generate posts daily or weekly. Multi-model support: Change the parameter in Ollama calls to use other models like , , or . Platform expansion: Edit the prompt to include additional platforms (e.g., Facebook, TikTok) or output formats. Integration with publishing tools: After the final output, add nodes to post directly to Twitter via API, save to a Google Sheet, or send to a CMS. Language/tonality: Adjust the and prompt instructions to generate content in different languages or styles.

6 nodes

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.