Mock Data Processing Workflow with Error Handling

Overview

This workflow demonstrates a simple data processing pipeline using n8n's built-in Function nodes. It starts with a manual trigger, generates mock data, transforms it, and includes a dedicated error handler to catch and stop the workflow on failure. It's an excellent starting point for learning how to manipulate data in n8n and implement basic error management.

Node-by-Node Breakdown

  1. Manual Trigger (No auth) — Provides a button in the n8n editor to manually start the workflow. No scheduling or webhook is used; you click "Execute Workflow" to run it.
  2. Mock Data (n8n Function Node, No auth) — This node uses custom JavaScript code to generate an array of four mock items: "item-1", "item-2", "item-3", "item-4". It wraps each item in the standard n8n .json format for downstream processing.
  3. Function (n8n Function Node, No auth) — Takes the array from the previous node and maps each item into a new object with a data key. For example, "item-1" becomes { data: "item-1" }. This is a common transformation pattern to reshape data before output or storage.
  4. Error Handler (Stop and Error Node, No auth) — Connected as an error workflow (although not wired in connections here), this node stops execution and throws a custom error message ("Workflow execution error"). In practice, it would be triggered if any previous node fails, preventing partial or corrupt data from propagating.

Setup Instructions

  1. No external accounts required — This workflow runs entirely within n8n and uses only built-in nodes. You do not need any API keys, OAuth, or external services.
  2. Import the JSON into your n8n instance via Workflows > Add Workflow > Import from File.
  3. Click Execute Workflow on the Manual Trigger node to see the mock data flow through the Function nodes.
  4. To test error handling, intentionally break the code in the Mock Data node (e.g., return invalid syntax) and observe how the Error Handler stops execution.

Use Cases & Variations

  • Learning & Prototyping: Perfect for beginners to understand data flow, JSON transformation, and error handling in n8n without external dependencies.
  • Data Transformation Pattern: Replace the Mock Data node with an HTTP Request or database query to fetch real data, then use the Function node to clean or restructure it.
  • Error Handling Template: Use the Stop and Error node as a pattern for any production workflow where you need to halt processing on failure and log a meaningful message.
  • CI/CD Pipelines: Combine with webhook triggers to simulate data processing within automated testing environments.

To adapt: Change the functionCode in Mock Data to pull from an API or CSV, or modify the Function node to aggregate, filter, or enrich the data.

4 nodesmanual triggerData
FunctionStop And Error

Workflow JSON

{
  "nodes": [
    {
      "id": "trigger-a3a1cb65",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        100,
        100
      ],
      "parameters": {}
    },
    {
      "name": "Mock Data",
      "type": "n8n-nodes-base.function",
      "position": [
        550,
        300
      ],
      "parameters": {
        "functionCode": "return [{json:[\"item-1\", \"item-2\", \"item-3\", \"item-4\"]}];"
      },
      "typeVersion": 1,
      "id": "acde4709-5dca-4894-80aa-c041f4a858e5",
      "notes": "This function node performs automated tasks as part of the workflow."
    },
    {
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        750,
        300
      ],
      "parameters": {
        "functionCode": "return items[0].json.map(item => {\n  return {\n    json: {\n      data:item\n    },\n  }\n});\n"
      },
      "typeVersion": 1,
      "id": "7cd01085-4de7-479d-99c1-974df410f456",
      "notes": "This function node performs automated tasks as part of the workflow."
    },
    {
      "id": "error-bf6f52d3",
      "name": "Error Handler",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1000,
        400
      ],
// ... 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

AI-Powered CV Scanner with Google Sheets & Gemini

Overview This workflow automates the initial screening of job applicants by combining a web form, AI-powered CV analysis, and Google Sheets. When a candidate submits their application (name, email, and CV PDF), the workflow instantly extracts the text from the PDF using Mistral OCR, then sends it to Google Gemini for evaluation against a predefined job description. The AI returns a qualification score (0.0 to 1.0) and a detailed explanation, which are then logged alongside the candidate's details in a Google Sheet. This eliminates manual CV review, speeds up your hiring pipeline, and ensures every applicant is evaluated consistently. Workflow Steps Application Form (Form Trigger) — No auth required. This node presents a custom-branded web form to collect the candidate's Full Name, Email, and CV (PDF upload). The form is styled with a dark, glassmorphism theme and includes animated backgrounds. Once submitted, the workflow triggers automatically. Log Candidate Submission (Google Sheets) — OAuth2. Immediately after form submission, this node appends the candidate's name and email to the 'CVs' Google Sheet. This ensures the application is recorded even if the subsequent analysis steps fail. Extract CV Text (Mistral AI) — API Key auth. This node takes the uploaded PDF file from the form and uses Mistral's OCR API to extract all text content from the CV. It dynamically selects the binary file uploaded in the previous step. AI Qualification (LLM Chain) — This is the core analysis node. It uses a detailed prompt that includes: - A system message defining the AI as a professional, objective hiring assistant. - The full job description for a "Senior Frontend Developer" with core requirements and preferred qualifications. - Clear evaluation logic: candidates missing core requirements cannot score above 0.6; meeting all core requirements yields at least 0.75; preferred qualifications add bonuses up to 1.0. - The extracted CV text as context. - An instruction to output raw JSON only. Gemini 2.5 Flash Lite (Language Model) — API Key auth (Google AI Studio). This node provides the actual AI model (Google Gemini 2.5 Flash Lite) with a temperature of 0.4 for balanced, deterministic outputs. It powers the LLM Chain above. JSON Output Parser (Output Parser) — This node ensures the AI's response is valid JSON with the exact schema: (number) and (string). It prevents malformed responses from breaking downstream nodes. Add CV Analysis (Google Sheets) — OAuth2. After analysis, this node updates the candidate's row in the 'CVs' sheet by matching on the Email column. It writes the and from the AI's output into the corresponding columns. Create 'CVs' Spreadsheet (Google Sheets) — OAuth2. This node runs once when the workflow is first triggered manually. It creates a new Google Sheet named 'CVs' with columns: FullName, Email, QualificationRate, QualificationDescription. Setup Instructions Prerequisites A Google account (for Google Sheets) A Mistral AI account (free tier available) — Get your API key here A Google AI Studio account — Create an API key here Step-by-Step Google Sheets Credentials: In the three Google Sheets nodes, create or select an OAuth2 credential for Google Sheets. Grant access to create and edit spreadsheets. Mistral AI Credential: In the "Extract CV Text" node, create a new credential and paste your Mistral API key. Gemini Credential: In the "Gemini 2.5 Flash Lite" node, create a new credential and paste your Google AI Studio API key. Customize Job Description: Open the "AI Qualification" node and edit the section in the prompt to match your actual job posting. Activate the Workflow: Toggle the workflow to "Active" status. The "Application Form" node will generate a public URL you can share with candidates. Test: Use the "Start Here" manual trigger to initialize the Google Sheet, then submit a test application via the form URL. Use Cases & Variations Custom Job Roles: Replace the Senior Frontend Developer description with any role (e.g., Marketing Manager, Data Scientist, Sales Rep) by editing the prompt in the AI Qualification node. Different Storage: Replace Google Sheets with Airtable, Notion, or a database like PostgreSQL for storing applications and results. Multi-Round Screening: Add a Slack or email notification node to alert the hiring team when a candidate scores above a certain threshold (e.g., >0.8). Interview Scheduling: Connect the output to a Calendly or Google Calendar node to automatically invite high-scoring candidates for an interview. Batch Processing: Modify the trigger to accept a CSV upload of multiple CVs for bulk analysis. Enhanced Analysis: Add more output fields like "years of experience", "top skills", or "red flags" by updating the JSON schema in the Output Parser and the prompt.

18 nodes

Talk to Your Google Sheets Data Using OpenAI Chat Agent

This workflow transforms a Google Sheet into a live, conversational database. Using an AI agent powered by OpenAI's GPT-4.1-nano model, you can ask natural language questions about your spreadsheet data and receive accurate, context-aware answers — without writing any SQL or formulas. The agent can handle queries like total campaign spend, per-channel breakdowns, month-over-month trends, and cost-per-lead calculations. Workflow Steps Node-by-Node Breakdown Chat with Your Data (Chat Trigger) — This is the entry point of the workflow. It provides a chat interface (webhook) where users type their questions. No authentication is required to trigger the webhook; access can be secured at the workflow level. Memory (Buffer Window Memory) — Stores recent conversation history so the AI can reference previous exchanges. The buffer window keeps the last few messages to maintain context without excessive token use. No authentication required. OpenAI Chat Model (OpenAI GPT-4.1-nano) — The language model that processes user questions and generates answers. Uses API Key auth (you must provide an OpenAI API key). Parameters: model = , no additional options configured. Talk to Your Data (AI Agent) — The core agent that orchestrates the conversation. It receives user input, decides which tool to call (only the Google Sheets tool is available), and returns answers. Uses API Key auth (uses the same OpenAI credential as the model). Parameters include a system message: "Google Sheets Ask-… You are Ask-… Answer questions using Google Sheets ONLY via the tool below. Be precise and conservative. There is only one dataset. Don't ask what dataset it is. Use the data tool to answer the question." Analyze Data (Google Sheets Tool) — The tool the agent calls to read spreadsheet data. Uses OAuth2 authentication (Google Sheets). Parameters: document ID = ("Sample Marketing Data - n8n"), sheet name = "Data" (gid: 365710158). No additional options set. Sticky Notes (Information Only) — Provide setup instructions and tips. Not executable nodes. Setup Instructions Before using this workflow, you need: OpenAI Account — Visit OpenAI API Keys to generate an API key. Make sure you have billing set up at OpenAI Billing and have credits available. Google Account — You need access to a Google Sheet. The sample uses a specific sheet, but you can point it to any sheet with a similar structure: first row = column headers, rows 2–100 = data. To configure: In the OpenAI Chat Model node, create an OpenAI credential with your API key. In the Analyze Data node, create a Google Sheets OAuth2 credential (select your Google account and authorize access). Update the Document ID and Sheet Name to match your own Google Sheet. Optionally update the system message in the Talk to Your Data agent if you want to change the assistant's personality or instructions. Use Cases and Variations This workflow is perfect for: Marketing teams wanting instant answers about campaign performance, spend, and ROI. Sales operations analyzing pipeline data, deal stages, or conversion metrics. Small business owners asking questions about inventory, sales, or customer data without learning SQL. Adaptations: Replace Google Sheets with another data source tool (e.g., Airtable, Notion, PostgreSQL, MySQL) by swapping the "Analyze Data" node. Add more tools to the agent (e.g., a web search tool, a calculator) to expand its capabilities. Change the model to GPT-4o or GPT-3.5-turbo for faster/cheaper responses. Add a Slack or Webhook trigger instead of the chat trigger for a different user interface.

11 nodes

Daily Web Scraper and Extract Data to Google Sheets

High-level Summary This workflow automatically scrapes a public web page every morning at 8:00 AM and appends the extracted data (e.g., product title, price) to a Google Sheet. It creates a time-series dataset that you can chart or analyze, making it ideal for tracking competitor prices, job listings, product availability, or any recurring data from a static HTML page. Node-by-Node Walkthrough Every Morning (Schedule Trigger) — No auth - Runs the workflow daily at 8:00 AM using a cron expression . Fetch Page (HTTP Request) — No auth - Requests the target URL (currently set to ). It fetches the full HTML of the page. Retries up to 3 times with a 5-second wait between attempts. Extract Values (HTML) — No auth - Uses CSS selectors to extract structured data from the HTML. Configured to extract: - from the first element. - from elements matching the selector . Add Date Stamp (Code) — No auth - A JavaScript code node that maps each input item to an output object containing: - : today's date in YYYY-MM-DD format. - and : copied from the HTML extraction step. Append Row (Google Sheets) — OAuth2 (Google account) - Appends a new row to a Google Sheet (specified by and ). The columns are automatically mapped from the input data, so each row will contain Date, Title, and Price. Setup Instructions Google Sheets Credentials: You need a Google account and an OAuth2 credential in n8n. If you haven't already, create a Google Sheets credential in n8n by authorizing your Google account. Replace Placeholders: - In the Fetch Page node, change the URL to the actual web page you want to scrape. - In the Append Row node, set the to the ID of your Google Sheet (found in the sheet's URL). Customize CSS Selectors: Open the target page in your browser, right-click on the data you want to extract, and select “Inspect”. Copy the CSS selector for each element and update the Extract Values node accordingly. Test: Run the workflow manually once to verify that the data is extracted and written correctly. Activate: Turn on the workflow to run automatically every morning. Use Cases and Adaptations Price Monitoring: Track prices of a product on e-commerce sites over time. Job Listings: Scrape a job board for new postings (combined with a filter to avoid duplicates). News Headlines: Collect daily headlines from a news site into a spreadsheet. Product Availability: Check if an item is in stock and log the status. Variations: Add an Error Trigger workflow to notify you via Slack or email if a scrape fails. Use IF nodes to only append rows when the price has changed. Replace the HTTP Request with an API node if the source offers a JSON API. Add additional extraction fields (e.g., rating, description, URL). Note: Only scrape public pages, respect the site's , and keep the schedule to once per day to avoid overloading the server.

8 nodes

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.