Bulk AI Image Generation via Freepik API and Google Drive Storage - n8n Workflow

Automate bulk AI image creation using this powerful n8n workflow. Read prompts from Google Sheets, generate unique images via Freepik API, convert base64 output, and save files directly to Google Drive. A perfect n8n template for content creators.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content creators needing to generate high volumes of unique AI images.

  • Marketing teams looking to automate visual asset production.

  • Developers interested in connecting Google Sheets data directly to third-party AI APIs using an n8n workflow.

  • Anyone looking for robust n8n templates integrating AI services and cloud storage.

Overview

Generating large batches of specific visual assets manually can be time-consuming and inefficient. This highly effective n8n workflow solves this problem by connecting your structured prompt data (stored in Google Sheets) directly to a powerful AI image generator, the Freepik API.

This specific n8n template is designed not only for bulk generation but also for creating variations; by using a custom n8n node for code execution, the workflow duplicates each prompt entry, ensuring two slightly different images are created for every single prompt defined in your spreadsheet. The final binary output is automatically named and organized within your Google Drive, providing a seamless, end-to-end automation pipeline. This advanced n8n automation simplifies asset creation significantly.

How it Works

The entire process is initiated by the manual n8n trigger, allowing you to control when batch processing begins.


  1. Data Retrieval: The Get Prompt from Google Sheet n8n node reads all defined prompts from a specified Google Sheets document.

  2. Prompt Duplication: The Double Output custom code n8n node takes each sheet row and creates two separate items, labeling them 'run 1' and 'run 2'. This ensures the subsequent steps generate two images for every input prompt.

  3. Looping: The Loop n8n node processes these items in batches, ensuring each prompt is sent individually.

  4. AI Generation: The Create Image HTTP Request n8n node calls the Freepik text-to-image API, passing the prompt value retrieved from the sheet data. Authentication is handled via a generic HTTP Header credential.

  5. Response Handling: The Split Responses n8n node parses the API response, which contains the generated image data (typically base64 encoded).

  6. Data Conversion: The Convert to File n8n node transforms the base64 encoded image string into a binary file format required for cloud storage.

  7. Storage: Finally, the Upload Image to Google Drive n8n node saves the image file to a designated folder in Google Drive. The file name is dynamically created using the original prompt's name and the 'run' number (1 or 2) from the Double Output node, ensuring unique naming and traceability within this comprehensive n8n workflow.

Installation Guide

To utilize this n8n template, follow these setup steps:


  1. Import the n8n workflow JSON: In your n8n instance, click 'New' > 'Import from JSON' and paste the provided code.

  2. Google Sheets Credential Setup: Configure the 'Google Sheets account' credential for the Get Prompt from Google Sheet n8n node. Ensure this account has read access to your prompt spreadsheet.

  3. Google Drive Credential Setup: Configure the 'Google Drive account' credential for the Upload Image to Google Drive n8n node. Specify the target folder ID where the final images will be stored.

  4. Freepik API Key Setup: Set up the 'Header Auth account' credential for the Create Image HTTP Request n8n node. This typically requires setting an Authorization header with your specific Freepik API key.

  5. Spreadsheet Preparation: Ensure your Google Sheet is set up with a column named 'Prompt' containing the text descriptions for the AI generator. This specific n8n workflow relies on accurate column mapping.

  6. Execution: Use the Start Workflow n8n trigger to manually run the batch process.

Node Details

Start Workflow (n8n trigger): A manual n8n trigger used to initiate the bulk processing job.
Get Prompt from Google Sheet (Google Sheets n8n node): Reads data from a specified document ID and sheet name. Supplies the prompts used for image generation.
Double Output (Code n8n node): Contains custom JavaScript to take one input prompt item and output two identical items, differing only by a run property (1 or 2). This multiplies the output of the n8n workflow.
Loop (Split In Batches n8n node): Manages the flow, ensuring each generated item (two per original prompt) is processed individually by the Freepik API.
Create Image (HTTP Request n8n node): The core AI generation n8n node. Sends a POST request to https://api.freepik.com/v1/ai/text-to-image. Key configuration: Body Parameters include prompt mapped to {{ $json.Prompt }}.
Split Responses (Split Out n8n node): Splits the JSON array returned by the Freepik API based on the data field, handling individual image responses.
Convert to File (Convert to File n8n node): Critical transformation step. Converts the base64 property in the response item into a storable binary file using the toBinary operation.
Upload Image to Google Drive (Google Drive n8n node): Uploads the binary image data. The file name is constructed using expressions referencing data from earlier steps in the n8n workflow for organizational purposes.

Related n8n Workflows

Free

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

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Featured*