Skip to main content

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

Workflow preview

Workflow preview
100%
Generate multiple AI images with DALL·E 2 and upload to Google Drive preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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...

Best for

  • Content Creation automation workflows
  • Multimodal AI automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.openai, n8n-nodes-base.splitinbatches, n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.googledrive, n8n-nodes-base.code, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Robert Breen.

Original n8n.io source

1.1 Workflow description

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

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: [email protected]

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Generate an image

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 2 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - Start Workflow

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 4 - Set Image Prompt

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - Upload to Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 6 - Duplicate Rows

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Generate multiple AI images with DALL·E 2 and upload to Google Drive
Complexity intermediate
Nodes 9
Categories Content Creation, Multimodal AI
Author Robert Breen
Published 10 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7222/7222.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate multiple AI images with DALL·E 2 and upload to Google Drive do?

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...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, Multimodal AI use case.