Back to Catalog

Generate multiple AI images with DALL·E 2 and upload to Google Drive

Robert BreenRobert Breen
766 views
2/3/2026
Official Page

n8n Workflow: OpenAI DALL·E 2 Image Generation & Google Drive Upload

Description

This n8n workflow automates the process of generating multiple AI-created images from a single prompt using OpenAI's DALL·E 2, then uploads the results directly to a Google Drive folder. It includes a loop to produce several image variations for the same prompt, making it ideal for creative projects, marketing materials, or content experimentation.


Step-by-Step Setup Instructions

1. Prepare Your API Keys

  • OpenAI API Key

    1. Sign up or log in at https://platform.openai.com/
    2. Go to API Keys and create a new one.
    3. Copy and store this securely — you'll need it in n8n.
  • Google Drive API

    1. Go to https://console.cloud.google.com/
    2. Create a project and enable Google Drive API.
    3. Create OAuth 2.0 credentials and set the redirect URI to your n8n OAuth redirect (found in your n8n Google Drive node setup).
    4. Connect your Google account when adding credentials in n8n.

2. Workflow Nodes Overview

  1. Manual Trigger – Starts the workflow manually.
  2. Set Image Prompt – Stores the prompt text and base file name (e.g., “Make an image of an attractive woman standing in New York City”).
  3. Duplicate Rows (Code Node) – Creates multiple "runs" of the same prompt for variation.
  4. Loop Over Items – Processes each variation one at a time.
  5. Generate an image (OpenAI DALL·E 2) – Sends the prompt to OpenAI and retrieves an image.
  6. Upload to Google Drive – Saves each generated image to your chosen Google Drive folder.

3. Building the Workflow in n8n

Step 1 — Manual Trigger

Add a Manual Trigger node to start the workflow manually when testing.

Step 2 — Set Image Prompt

Add a Set node with two fields:

  • Prompt → The image description text.
  • Name → The base name for the saved file.

Example:
| Name | Value | |--------|---------------------------------------------------------------| | Prompt | Make an image of an attractive woman standing in New York City | | Name | woman-nyc |

Step 3 — Duplicate Rows (Code Node)

Use this JavaScript to create three copies of the prompt (run 1, run 2, run 3):

const original = items[0].json;

return [
  { json: { ...original, run: 1 } },
  { json: { ...original, run: 2 } },
  { json: { ...original, run: 3 } },
];

#### Step 4 — Loop Over Items
Insert a **Split in Batches** node and set the batch size to `1`. This ensures each prompt variation runs through the image generation process individually. Connect this node so it runs after the **Duplicate Rows** node.

#### Step 5 — Generate Image
Add the **OpenAI Image Generation** node and configure it as follows:
- **Model**: `dall-e-2`
- **Prompt**: `={{ $json.Prompt }}`
- Leave other options at their defaults unless you want to specify image size or style.
- Connect your **OpenAI API** credentials created in Step 1.

This node will send the current prompt in the batch to OpenAI's DALL·E 2 model and return an AI-generated image.

#### Step 6 — Upload to Google Drive
Add a **Google Drive** node and configure it to store the generated image:
- **File Name**:  
  `={{ $('Set Image Prompt').item.json.Name }} - {{ $('Duplicate Rows').item.json.run }}`
- **Folder ID**: Select the target Google Drive folder where images should be saved.
- Connect your **Google Drive OAuth2 API** credentials.

The node will upload each generated image to your chosen Google Drive location, with a unique filename for each variation.

---

### Running the Workflow
1. Execute the workflow manually.
2. The process will:
   - Loop through each prompt variation.
   - Generate an image using OpenAI DALL·E 2.
   - Upload the image to Google Drive with a unique name.
3. You will find all generated images in the selected Google Drive folder.

---

### Customization Tips
- Change the number of variations by editing the **Duplicate Rows** code.
- Adjust the prompt dynamically from other data sources like Google Sheets, webhooks, or forms.
- Schedule the workflow to run at specific times or trigger it via an API call.

---

**Created by Robert A. – Ynteractive**  
Website: https://ynteractive.com  
Email: robert@ynteractive.com

Generate Multiple AI Images with DALL-E 2 and Upload to Google Drive

This n8n workflow streamlines the process of generating multiple AI images using DALL-E 2 based on a list of prompts, and then automatically uploads these generated images to a specified folder in Google Drive.

What it does

  1. Triggers Manually: The workflow is initiated by a manual trigger, allowing you to run it on demand.
  2. Sets Image Prompts: An "Edit Fields (Set)" node is used to define the AI image prompts. These prompts are passed as a list of items to the subsequent nodes.
  3. Loops Over Prompts: The "Loop Over Items (Split in Batches)" node processes each image prompt individually, ensuring that DALL-E 2 generates an image for every prompt.
  4. Generates Images with DALL-E 2: For each prompt, the "OpenAI" node (configured for DALL-E 2 image generation) creates an image.
  5. Uploads to Google Drive: The generated image is then uploaded to a designated folder in Google Drive using the "Google Drive" node.
  6. Optional Code for Dynamic File Naming (Implied): A "Code" node is present, which could be used for advanced logic such as dynamically naming the uploaded files based on the prompt or other metadata.
  7. Sticky Note for Instructions/Context: A "Sticky Note" is included, likely providing instructions or context within the workflow itself.

Prerequisites/Requirements

  • n8n Instance: A running n8n instance.
  • OpenAI Account & API Key: An OpenAI account with access to DALL-E 2 and a valid API key configured as an n8n credential.
  • Google Account & Credentials: A Google account with Google Drive enabled, and Google Drive credentials configured in n8n with appropriate permissions to upload files to a specific folder.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • OpenAI: Set up your OpenAI API Key credential in n8n.
    • Google Drive: Set up your Google Drive OAuth2 or API Key credential in n8n.
  3. Customize Prompts: In the "Edit Fields (Set)" node, modify the list of prompts under the data field to reflect the images you wish to generate. Each item in the list should be a separate prompt.
  4. Configure Google Drive Upload:
    • In the "Google Drive" node, select the "Upload" operation.
    • Specify the Folder ID where you want the images to be uploaded.
    • Ensure the File Name expression is correctly set to give meaningful names to your uploaded images (e.g., using the prompt text or a generated identifier).
  5. Review Code Node (Optional): If the "Code" node contains logic for file naming or other transformations, review and adjust it as needed.
  6. Execute Workflow: Click the "Execute workflow" button in the "When clicking ‘Execute workflow’" (Manual Trigger) node to run the workflow.

Related Templates

AI multi-agent executive team for entrepreneurs with Gemini, Perplexity and WhatsApp

This workflow is an AI-powered multi-agent system built for startup founders and small business owners who want to automate decision-making, accountability, research, and communication, all through WhatsApp. The “virtual executive team,” is designed to help small teams to work smarter. This workflow sends you market analysis, market and sales tips, It can also monitor what your competitors are doing using perplexity (Research agent) and help you stay a head, or make better decisions. And when you feeling stuck with your start-up accountability director is creative enough to break the barrier 🎯 Core Features 🧑‍💼 1. President (Super Agent) Acts as the main controller that coordinates all sub-agents. Routes messages, assigns tasks, and ensures workflow synchronization between the AI Directors. 📊 2. Sales & Marketing Director Uses SerpAPI to search for market opportunities, leads, and trends. Suggests marketing campaigns, keywords, or outreach ideas. Can analyze current engagement metrics to adjust content strategy. 🕵️‍♀️ 3. Business Research Director Powered by Perplexity AI for competitive and market analysis. Monitors competitor moves, social media engagement, and product changes. Provides concise insights to help the founder adapt and stay ahead. ⏰ 4. Accountability Director Keeps the founder and executive team on track. Sends motivational nudges, task reminders, and progress reports. Promotes consistency and discipline — key traits for early-stage success. 🗓️ 5. Executive Secretary Handles scheduling, email drafting, and reminders. Connects with Google Calendar, Gmail, and Sheets through OAuth. Automates follow-ups, meeting summaries, and notifications directly via WhatsApp. 💬 WhatsApp as the Main Interface Interact naturally with your AI team through WhatsApp Business API. All responses, updates, and summaries are delivered to your chat. Ideal for founders who want to manage operations on the go. ⚙️ How It Works Trigger: The workflow starts from a WhatsApp Trigger node (via Meta Developer Account). Routing: The President agent analyzes the incoming message and determines which Director should handle it. Processing: Marketing or sales queries go to the Sales & Marketing Director. Research questions are handled by the Business Research Director. Accountability tasks are assigned to the Accountability Director. Scheduling or communication requests are managed by the Secretary. Collaboration: Each sub-agent returns results to the President, who summarizes and sends the reply back via WhatsApp. Memory: Context is maintained between sessions, ensuring personalized and coherent communication. 🧩 Integrations Required Gemini API – for general intelligence and task reasoning Supabase- for RAG and postgres persistent memory Perplexity API – for business and competitor analysis SerpAPI – for market research and opportunity scouting Google OAuth – to connect Sheets, Calendar, and Gmail WhatsApp Business API – for message triggers and responses 🚀 Benefits Acts like a team of tireless employees available 24/7. Saves time by automating research, reminders, and communication. Enhances accountability and strategy consistency for founders. Keeps operations centralized in a simple WhatsApp interface. 🧰 Setup Steps Create API credentials for: WhatsApp (via Meta Developer Account) Gemini, Perplexity, and SerpAPI Google OAuth (Sheets, Calendar, Gmail) Create a supabase account at supabase Add the credentials in the corresponding n8n nodes. Customize the system prompts for each Director based on your startup’s needs. Activate and start interacting with your virtual executive team on WhatsApp. Use Case You are a small organisation or start-up that can not afford hiring; marketing department, research department and secretar office, then this workflow is for you 💡 Need Customization? Want to tailor it for your startup or integrate with CRM tools like Notion or HubSpot? You can easily extend the workflow or contact the creator for personalized support. Consider adjusting the system prompt to suite your business

ShadrackBy Shadrack
331

🎓 How to transform unstructured email data into structured format with AI agent

This workflow automates the process of extracting structured, usable information from unstructured email messages across multiple platforms. It connects directly to Gmail, Outlook, and IMAP accounts, retrieves incoming emails, and sends their content to an AI-powered parsing agent built on OpenAI GPT models. The AI agent analyzes each email, identifies relevant details, and returns a clean JSON structure containing key fields: From – sender’s email address To – recipient’s email address Subject – email subject line Summary – short AI-generated summary of the email body The extracted information is then automatically inserted into an n8n Data Table, creating a structured database of email metadata and summaries ready for indexing, reporting, or integration with other tools. --- Key Benefits ✅ Full Automation: Eliminates manual reading and data entry from incoming emails. ✅ Multi-Source Integration: Handles data from different email providers seamlessly. ✅ AI-Driven Accuracy: Uses advanced language models to interpret complex or unformatted content. ✅ Structured Storage: Creates a standardized, query-ready dataset from previously unstructured text. ✅ Time Efficiency: Processes emails in real time, improving productivity and response speed. *✅ Scalability: Easily extendable to handle additional sources or extract more data fields. --- How it works This workflow automates the transformation of unstructured email data into a structured, queryable format. It operates through a series of connected steps: Email Triggering: The workflow is initiated by one of three different email triggers (Gmail, Microsoft Outlook, or a generic IMAP account), which constantly monitor for new incoming emails. AI-Powered Parsing & Structuring: When a new email is detected, its raw, unstructured content is passed to a central "Parsing Agent." This agent uses a specified OpenAI language model to intelligently analyze the email text. Data Extraction & Standardization: Following a predefined system prompt, the AI agent extracts key information from the email, such as the sender, recipient, subject, and a generated summary. It then forces the output into a strict JSON structure using a "Structured Output Parser" node, ensuring data consistency. Data Storage: Finally, the clean, structured data (the from, to, subject, and summarize fields) is inserted as a new row into a specified n8n Data Table, creating a searchable and reportable database of email information. --- Set up steps To implement this workflow, follow these configuration steps: Prepare the Data Table: Create a new Data Table within n8n. Define the columns with the following names and string type: From, To, Subject, and Summary. Configure Email Credentials: Set up the credential connections for the email services you wish to use (Gmail OAuth2, Microsoft Outlook OAuth2, and/or IMAP). Ensure the accounts have the necessary permissions to read emails. Configure AI Model Credentials: Set up the OpenAI API credential with a valid API key. The workflow is configured to use the model, but this can be changed in the respective nodes if needed. Connect the Nodes: The workflow canvas is already correctly wired. Visually confirm that the email triggers are connected to the "Parsing Agent," which is connected to the "Insert row" (Data Table) node. Also, ensure the "OpenAI Chat Model" and "Structured Output Parser" are connected to the "Parsing Agent" as its AI model and output parser, respectively. Activate the Workflow: Save the workflow and toggle the "Active" switch to ON. The triggers will begin polling for new emails according to their schedule (e.g., every minute), and the automation will start processing incoming messages. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.

DavideBy Davide
1616

Automated YouTube video uploads with 12h interval scheduling in JST

This workflow automates a batch upload of multiple videos to YouTube, spacing each upload 12 hours apart in Japan Standard Time (UTC+9) and automatically adding them to a playlist. ⚙️ Workflow Logic Manual Trigger — Starts the workflow manually. List Video Files — Uses a shell command to find all .mp4 files under the specified directory (/opt/downloads/单词卡/A1-A2). Sort and Generate Items — Sorts videos by day number (dayXX) extracted from filenames and assigns a sequential order value. Calculate Publish Schedule (+12h Interval) — Computes the next rounded JST hour plus a configurable buffer (default 30 min). Staggers each video’s scheduled time by order × 12 hours. Converts JST back to UTC for YouTube’s publishAt field. Split in Batches (1 per video) — Iterates over each video item. Read Video File — Loads the corresponding video from disk. Upload to YouTube (Scheduled) — Uploads the video privately with the computed publishAtUtc. Add to Playlist — Adds the newly uploaded video to the target playlist. 🕒 Highlights Timezone-safe: Pure UTC ↔ JST conversion avoids double-offset errors. Sequential scheduling: Ensures each upload is 12 hours apart to prevent clustering. Customizable: Change SPANHOURS, BUFFERMIN, or directory paths easily. Retry-ready: Each upload and playlist step has retry logic to handle transient errors. 💡 Typical Use Cases Multi-part educational video series (e.g., A1–A2 English learning). Regular content release cadence without manual scheduling. Automated YouTube publishing pipelines for pre-produced content. --- Author: Zane Category: Automation / YouTube / Scheduler Timezone: JST (UTC+09:00)

ZaneBy Zane
226