Bulk Text-to-Image Generation with Google Sheets and Drive - n8n Workflow

Use this powerful n8n workflow to automate bulk text-to-image generation from Google Sheets prompts using the Flux AI API, handling base64 conversion, Google Drive uploads, and error logging.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

• Content Agencies needing to generate hundreds of marketing visuals quickly.
• Marketers managing product catalogs or social media content at scale.
• Developers looking for robust n8n templates integrating AI APIs with cloud storage.
• Users seeking a reliable n8n node combination for data fetching, processing, and file handling.

Overview

Managing large-scale image generation can be tedious. This powerful n8n workflow solves this by reading numerous text prompts directly from a Google Sheet, executing image generation via the Text To Image Flux AI API (using RapidAPI), and handling the entire backend process—including base64 decoding, file conversion, Google Drive uploading, and logging the results.

This robust n8n automation ensures that only prompts without existing outputs are processed, thanks to a conditional n8n node, preventing wasteful reprocessing. It also incorporates error handling and a crucial 'Wait' step to manage API rate limits, making this one of the most reliable n8n templates for high-volume AI asset creation.

How it Works

This comprehensive n8n workflow is initiated manually, making it a controlled process for bulk runs.


  1. Initiation: The 'When clicking ‘Execute workflow’' n8n trigger starts the process.

  2. Data Ingestion: The Google Sheets2 n8n node reads all existing rows (containing image prompts) from your designated spreadsheet.

  3. Batch Processing: The Loop Over Items n8n node processes each row individually, ensuring sequential execution to manage resources.

  4. Pre-check: An If2 n8n node checks two conditions: if the Prompt field is populated and if the drive path column is empty. Only items needing generation continue.

  5. AI Request: The HTTP Request1 n8n node sends the text prompt to the Flux AI API via RapidAPI, receiving the generated image data as a base64 encoded string.

  6. Error Handling: The If1 n8n node immediately checks the API response for an error key. If an error is found, the data is routed to Google Sheets4 to log the failure.

  7. Base64 Conversion (Success Path): If successful, the Code1 n8n node converts the massive base64 string into a binary JPEG file, ready for storage.

  8. Logging: The Google Sheets1 n8n node updates the original sheet row with the base64 data and a timestamp.

  9. Storage: The Google Drive1 n8n node uploads the binary image file to the specified Google Drive folder.

  10. Rate Limiting: Both success and error paths converge to a Wait n8n node, which pauses for 10 seconds before the loop continues with the next prompt, maintaining stable operation and respecting API limits. This careful structure makes it a highly efficient n8n workflow.

Installation Guide

To deploy and utilize this n8n workflow, follow these setup steps:


  1. Import: Copy the provided JSON and import it into your n8n instance using the 'New' -> 'Import from JSON' feature.

  2. Credentials Setup:

Google Sheets & Drive: You must set up a single Google Service Account credential (used by Google Sheets2, Google Sheets1, Google Sheets4, and Google Drive1). Ensure this service account has edit access to your Google Sheet and write access to the target Google Drive folder.
RapidAPI/Flux AI: Set up an HTTP Request credential or directly update the HTTP Request1 n8n node with your RapidAPI Host and Key headers. The current setup includes a placeholder key (your key).

  1. Google Sheets Configuration: In the Google Sheets2 node, specify the Document ID and Sheet Name where your prompts are located. Ensure your sheet has columns like Prompt and drive path.

  2. Google Drive Configuration: In the Google Drive1 n8n node, specify the Folder ID where the generated images should be saved.

  3. Execution: After configuration, click the 'Execute workflow' n8n trigger to start the bulk generation.

Node Details

This n8n workflow relies on several specialized nodes to manage data flow and AI integration:

When clicking ‘Execute workflow’ (Manual Trigger n8n trigger):
Function: Serves as the immediate starter for the n8n workflow, allowing manual control over bulk processing runs.
Key Configuration: Standard manual activation.

Google Sheets2 (n8n node):
Function: Reads all input data from the designated Google Sheet, fetching the list of prompts.
Key Configuration: Operation: Read, Authentication: Service Account.

Loop Over Items (Split In Batches n8n node):
Function: Ensures that each row (prompt) is processed sequentially through the subsequent AI and storage steps, essential for managing rate limits and data context.
Key Configuration: Splits items into individual batches.

HTTP Request1 (n8n node):
Function: Sends the text prompt dynamically (={{ $json.Prompt }}) to the external Flux AI endpoint, retrieving the image data.
Key Configuration: Method: POST, URL: https://text-to-image-flux-ai.p.rapidapi.com/flux.php, Headers require x-rapidapi-key.

Code1 (n8n node):
Function: Crucial for data preparation. It takes the returned image_base64 string from the API, cleans it (removes prefixes), converts it into a binary Buffer, and sets the mime type (image/jpeg) for subsequent file operations.
Key Configuration: Custom JavaScript code for base64 to binary conversion.

Google Drive1 (n8n node):
Function: Uploads the newly created binary image file to a specified folder in Google Drive.
Key Configuration: Resource: File, Operation: Upload, Folder ID and Drive ID must be set.

Wait (n8n node):
Function: Enforces a 10-second pause after each item is processed (or fails), effectively throttling the execution speed to prevent API rate limit issues. This is a best practice for high-throughput n8n templates.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
Evoort Solutions
Evoort Solutions

Featured*