Back to Catalog

Predict next 5-day stock trends with Twelve Data API & Google Sheets

Oneclick AI SquadOneclick AI Squad
429 views
2/3/2026
Official Page

This automated n8n workflow fetches stock data from the Twelve Data API after market close, predicts 5-day trends using AI analysis, updates Google Sheets with the results, and sends an email summary report. This process helps users stay informed about stock movements and make data-driven decisions efficiently.

Good to Know

  • AI prediction accuracy improves with more historical stock data.
  • Market conditions and external factors can influence prediction outcomes.
  • Google Sheets access must be authorized to ensure smooth data updates.
  • Email notifications ensure timely delivery of summary reports.
  • The system relies on the Twelve Data API as the primary data source.

How It Works

  • Daily Market Close Trigger - Initiates the workflow daily at 9:00 PM (after market close), Monday to Friday.
  • Read Stock Symbols - Reads stock symbols from a Google Sheet to determine which stocks to analyze.
  • Set Configuration Variables - Configures API keys and other necessary variables manually.
  • Fetch 5-Day Stock Data - Retrieves 5-day stock data from the Twelve Data API.
  • Analyze Stock Trends - Uses AI to predict 5-day stock price movements based on the fetched data.
  • Update Google Sheet - Appends the analysis results to a Google Sheet for tracking.
  • Format Email Report - Creates a concise, human-friendly summary of the stock predictions.
  • Send Email Report - Delivers the summary report via email to designated recipients.

Data Sources

The workflow utilizes one Google Sheet:

  • Stock Data Sheet - Contains stock analysis data with columns:
    • Date (date)
    • Stock Symbol (text)
    • Current Price (number)
    • Predicted 5-Day Trend (text)
    • Confidence Level (number)
    • Notes (text)

How to Use

  • Import the workflow into n8n.
  • Configure Google Sheets API access and authorize the application.
  • Set up email credentials for report delivery.
  • Create the required Google Sheet with the specified column structure.
  • Configure the Twelve Data API key.
  • Test with sample stock data to verify predictions and email delivery.
  • Adjust analysis parameters based on your specific stock monitoring needs.
  • Monitor and refine the system based on actual vs. predicted trends.

Requirements

  • Google Sheets API access.
  • Email service credentials (Gmail, SMTP, etc.).
  • Twelve Data API key.
  • Initial stock data for analysis.

Customizing This Workflow

Modify the Stock Trend Predictor parameters to focus on specific stock sectors or adjust prediction horizons. Customize the email report format to match your preferences and integrate additional data sources like news feeds or financial indicators if needed.

Predict Next 5-Day Stock Trends with Twelve Data API & Google Sheets

This n8n workflow automates the process of fetching stock data, predicting future trends, and storing the results in Google Sheets, with email notifications for successful runs.

Description

This workflow is designed to periodically retrieve stock data for a specified symbol using the Twelve Data API, process this data to predict the next 5-day trend (though the prediction logic itself is not explicitly defined in the provided JSON, it's implied by the directory name and the presence of a "Code" node), and then record the results in a Google Sheet. It also sends an email notification upon successful completion of the data processing and sheet update.

What it does

  1. Schedules Execution: The workflow is triggered on a recurring schedule (defined by the Cron node).
  2. Fetches Stock Data: It makes an HTTP request to the Twelve Data API to retrieve historical stock data for a specified symbol.
  3. Processes Data (Code Node): A Code node is included, which is typically used for custom logic. In this context, it's expected to contain the logic for analyzing the fetched stock data and predicting the next 5-day trend.
  4. Prepares Data for Google Sheets: An "Edit Fields (Set)" node likely transforms or formats the data, including the prediction, into a structure suitable for appending to a Google Sheet.
  5. Records Data in Google Sheets: The processed stock data and trend prediction are appended as a new row to a designated Google Sheet.
  6. Sends Email Notification: Upon successful execution, an email is sent to notify the user about the completion of the workflow, likely including details about the processed stock and its predicted trend.

Prerequisites/Requirements

  • n8n Instance: A running n8n instance.
  • Twelve Data API Key: An API key for the Twelve Data service to fetch stock data. This will need to be configured in the "HTTP Request" node.
  • Google Account: A Google account with access to Google Sheets. You'll need to set up Google Sheets credentials in n8n.
  • Google Sheet: A pre-existing Google Sheet where the stock trends will be recorded. You'll need to specify the Spreadsheet ID and Sheet Name in the "Google Sheets" node.
  • SMTP Server/Email Service: Credentials for an email service (e.g., SMTP, Gmail, Outlook) to send notifications. This will need to be configured in the "Send Email" node.

Setup/Usage

  1. Import the Workflow:
    • Download the provided JSON file.
    • In your n8n instance, go to "Workflows" and click "New".
    • Click the "Import from JSON" button and paste the workflow JSON or upload the file.
  2. Configure Credentials:
    • HTTP Request (Twelve Data): Edit the "HTTP Request" node. You will need to add your Twelve Data API Key, likely as a query parameter or header, and specify the stock symbol and other API parameters.
    • Google Sheets: Edit the "Google Sheets" node. Select or create a new Google Sheets OAuth2 credential. You will also need to specify the "Spreadsheet ID" and "Sheet Name" where the data should be written.
    • Send Email: Edit the "Send Email" node. Select or create a new credential for your email service (e.g., SMTP, Gmail, Outlook). Configure the recipient email address, subject, and body of the notification email.
  3. Customize Code Node (Prediction Logic):
    • Edit the "Code" node. This is where you will implement the actual logic for predicting the 5-day stock trend based on the data received from the Twelve Data API. The current JSON does not contain specific prediction logic, so you will need to add your own JavaScript code here to analyze the json.data and output a prediction.
  4. Configure Cron Schedule:
    • Edit the "Cron" node to set your desired schedule for when the workflow should run (e.g., daily, weekly).
  5. Activate the Workflow:
    • Once all credentials and configurations are set, save and activate the workflow.

Related Templates

AI-powered code review with linting, red-marked corrections in Google Sheets & Slack

Advanced Code Review Automation (AI + Lint + Slack) Who’s it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting — all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0–10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your team’s channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow — reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why it’s valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n — combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your team’s review history transparent and centralized.

higashiyama By higashiyama
90

Auto-reply & create Linear tickets from Gmail with GPT-5, gotoHuman & human review

This workflow automatically classifies every new email from your linked mailbox, drafts a personalized reply, and creates Linear tickets for bugs or feature requests. It uses a human-in-the-loop with gotoHuman and continuously improves itself by learning from approved examples. How it works The workflow triggers on every new email from your linked mailbox. Self-learning Email Classifier: an AI model categorizes the email into defined categories (e.g., Bug Report, Feature Request, Sales Opportunity, etc.). It fetches previously approved classification examples from gotoHuman to refine decisions. Self-learning Email Writer: the AI drafts a reply to the email. It learns over time by using previously approved replies from gotoHuman, with per-classification context to tailor tone and style (e.g., different style for sales vs. bug reports). Human Review in gotoHuman: review the classification and the drafted reply. Drafts can be edited or retried. Approved values are used to train the self-learning agents. Send approved Reply: the approved response is sent as a reply to the email thread. Create ticket: if the classification is Bug or Feature Request, a ticket is created by another AI agent in Linear. Human Review in gotoHuman: How to set up Most importantly, install the gotoHuman node before importing this template! (Just add the node to a blank canvas before importing) Set up credentials for gotoHuman, OpenAI, your email provider (e.g. Gmail), and Linear. In gotoHuman, select and create the pre-built review template "Support email agent" or import the ID: 6fzuCJlFYJtlu9mGYcVT. Select this template in the gotoHuman node. In the "gotoHuman: Fetch approved examples" http nodes you need to add your formId. It is the ID of the review template that you just created/imported in gotoHuman. Requirements gotoHuman (human supervision, memory for self-learning) OpenAI (classification, drafting) Gmail or your preferred email provider (for email trigger+replies) Linear (ticketing) How to customize Expand or refine the categories used by the classifier. Update the prompt to reflect your own taxonomy. Filter fetched training data from gotoHuman by reviewer so the writer adapts to their personalized tone and preferences. Add more context to the AI email writer (calendar events, FAQs, product docs) to improve reply quality.

gotoHumanBy gotoHuman
353

Ai website scraper & company intelligence

AI Website Scraper & Company Intelligence Description This workflow automates the process of transforming any website URL into a structured, intelligent company profile. It's triggered by a form, allowing a user to submit a website and choose between a "basic" or "deep" scrape. The workflow extracts key information (mission, services, contacts, SEO keywords), stores it in a structured Supabase database, and archives a full JSON backup to Google Drive. It also features a secondary AI agent that automatically finds and saves competitors for each company, building a rich, interconnected database of company intelligence. --- Quick Implementation Steps Import the Workflow: Import the provided JSON file into your n8n instance. Install Custom Community Node: You must install the community node from: https://www.npmjs.com/package/n8n-nodes-crawl-and-scrape FIRECRAWL N8N Documentation https://docs.firecrawl.dev/developer-guides/workflow-automation/n8n Install Additional Nodes: n8n-nodes-crawl-and-scrape and n8n-nodes-mcp fire crawl mcp . Set up Credentials: Create credentials in n8n for FIRE CRAWL API,Supabase, Mistral AI, and Google Drive. Configure API Key (CRITICAL): Open the Web Search tool node. Go to Parameters → Headers and replace the hardcoded Tavily AI API key with your own. Configure Supabase Nodes: Assign your Supabase credential to all Supabase nodes. Ensure table names (e.g., companies, competitors) match your schema. Configure Google Drive Nodes: Assign your Google Drive credential to the Google Drive2 and save to Google Drive1 nodes. Select the correct Folder ID. Activate Workflow: Turn on the workflow and open the Webhook URL in the “On form submission” node to access the form. --- What It Does Form Trigger Captures user input: “Website URL” and “Scraping Type” (basic or deep). Scraping Router A Switch node routes the flow: Deep Scraping → AI-based MCP Firecrawler agent. Basic Scraping → Crawlee node. Deep Scraping (Firecrawl AI Agent) Uses Firecrawl and Tavily Web Search. Extracts a detailed JSON profile: mission, services, contacts, SEO keywords, etc. Basic Scraping (Crawlee) Uses Crawl and Scrape node to collect raw text. A Mistral-based AI extractor structures the data into JSON. Data Storage Stores structured data in Supabase tables (companies, company_basicprofiles). Archives a full JSON backup to Google Drive. Automated Competitor Analysis Runs after a deep scrape. Uses Tavily web search to find competitors (e.g., from Crunchbase). Saves competitor data to Supabase, linked by company_id. --- Who's It For Sales & Marketing Teams: Enrich leads with deep company info. Market Researchers: Build structured, searchable company databases. B2B Data Providers: Automate company intelligence collection. Developers: Use as a base for RAG or enrichment pipelines. --- Requirements n8n instance (self-hosted or cloud) Supabase Account: With tables like companies, competitors, social_links, etc. Mistral AI API Key Google Drive Credentials Tavily AI API Key (Optional) Custom Nodes: n8n-nodes-crawl-and-scrape --- How It Works Flow Summary Form Trigger: Captures “Website URL” and “Scraping Type”. Switch Node: deep → MCP Firecrawler (AI Agent). basic → Crawl and Scrape node. Scraping & Extraction: Deep path: Firecrawler → JSON structure. Basic path: Crawlee → Mistral extractor → JSON. Storage: Save JSON to Supabase. Archive in Google Drive. Competitor Analysis (Deep Only): Finds competitors via Tavily. Saves to Supabase competitors table. End: Finishes with a No Operation node. --- How To Set Up Import workflow JSON. Install community nodes (especially n8n-nodes-crawl-and-scrape from npm). Configure credentials (Supabase, Mistral AI, Google Drive). Add your Tavily API key. Connect Supabase and Drive nodes properly. Fix disconnected “basic” path if needed. Activate workflow. Test via the webhook form URL. --- How To Customize Change LLMs: Swap Mistral for OpenAI or Claude. Edit Scraper Prompts: Modify system prompts in AI agent nodes. Change Extraction Schema: Update JSON Schema in extractor nodes. Fix Relational Tables: Add Items node before Supabase inserts for arrays (social links, keywords). Enhance Automation: Add email/slack notifications, or replace form trigger with a Google Sheets trigger. --- Add-ons Automated Trigger: Run on new sheet rows. Notifications: Email or Slack alerts after completion. RAG Integration: Use the Supabase database as a chatbot knowledge source. --- Use Case Examples Sales Lead Enrichment: Instantly get company + competitor data from a URL. Market Research: Collect and compare companies in a niche. B2B Database Creation: Build a proprietary company dataset. --- WORKFLOW IMAGE --- Troubleshooting Guide | Issue | Possible Cause | Solution | |-------|----------------|-----------| | Form Trigger 404 | Workflow not active | Activate the workflow | | Web Search Tool fails | Missing Tavily API key | Replace the placeholder key | | FIRECRAWLER / find competitor fails | Missing MCP node | Install n8n-nodes-mcp | | Basic scrape does nothing | Switch node path disconnected | Reconnect “basic” output | | Supabase node error | Wrong table/column names | Match schema exactly | --- Need Help or More Workflows? Want to customize this workflow for your business or integrate it with your existing tools? Our team at Digital Biz Tech can tailor it precisely to your use case from automation logic to AI-powered enhancements. Contact: shilpa.raju@digitalbiz.tech For more such offerings, visit us: https://www.digitalbiz.tech ---

DIGITAL BIZ TECHBy DIGITAL BIZ TECH
923