Generate AI images in bulk with Freepik, Google Sheets & Drive
This n8n workflow automates bulk AI image generation using Freepik's Text-to-Image API. It reads prompts from a Google Sheet, generates multiple variations of each image using Freepik's AI, and automatically uploads the results to Google Drive with organized file names. This is perfect for content creators, marketers, or designers who need to generate multiple AI images in bulk and store them systematically.
Key Features:
- Bulk image generation from Google Sheets prompts
- Multiple variations per prompt (configurable duplicates)
- Automatic file naming and organization
- Direct upload to Google Drive
- Batch processing for efficient API usage
- Freepik AI-powered image generation
Step-by-Step Implementation Guide
Prerequisites
Before setting up this workflow, you'll need:
- n8n instance (cloud or self-hosted)
- Freepik API account with Text-to-Image access
- Google account with access to Sheets and Drive
- Google Sheet with your prompts
Step 1: Set Up Freepik API Credentials
- Go to Freepik API Developer Portal
- Create an account or sign in
- Navigate to your API dashboard
- Generate an API key for Text-to-Image service
- Copy the API key and save it securely
- In n8n, go to Credentials → Add Credential → HTTP Header Auth
- Configure as follows:
- Name: "Header Auth account"
- Header Name:
x-freepik-api-key - Header Value: Your Freepik API key
Step 2: Set Up Google Credentials
Google Sheets Access:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google Sheets API
- Create OAuth2 credentials
- In n8n, go to Credentials → Add Credential → Google Sheets OAuth2 API
- Enter your OAuth2 credentials and authorize with
spreadsheets.readonlyscope
Google Drive Access:
- In Google Cloud Console, enable Google Drive API
- In n8n, go to Credentials → Add Credential → Google Drive OAuth2 API
- Enter your OAuth2 credentials and authorize
Step 3: Create Your Google Sheet
- Create a new Google Sheet: sheets.google.com
- Set up your sheet with these columns:
- Column A:
Prompt(your image generation prompts) - Column B:
Name(identifier for file naming)
- Column A:
- Example data:
| Prompt | Name | |-------------------------------------------|-------------| | A serene mountain landscape at sunrise | mountain-01 | | Modern office space with natural lighting | office-02 | | Cozy coffee shop interior | cafe-03 | - Copy the Sheet ID from the URL (the long string between
/d/and/edit)
Step 4: Set Up Google Drive Folder
- Create a folder in Google Drive for your generated images
- Copy the Folder ID from the URL when viewing the folder
- Note: The workflow is configured to use a folder called "n8n workflows"
Step 5: Import and Configure the Workflow
- Copy the provided workflow JSON
- In n8n, click Import from File or Import from Clipboard
- Paste the workflow JSON
- Configure each node as detailed below:
Node Configuration Details:
Start Workflow (Manual Trigger)
- No configuration needed
- Used to manually start the workflow
Get Prompt from Google Sheet (Google Sheets)
- Document ID: Your Google Sheet ID (from Step 3)
- Sheet Name:
Sheet1(or your sheet name) - Operation: Read
- Credentials: Select your "Google Sheets account"
Double Output (Code Node)
- Purpose: Creates multiple variations of each prompt
- JavaScript Code:
const original = items[0].json;
return [
{ json: { ...original, run: 1 } },
{ json: { ...original, run: 2 } },
];
- Customization: Add more runs for additional variations
Loop (Split in Batches)
- Processes items in batches to manage API rate limits
- Options: Keep default settings
- Reset:
false
Create Image (HTTP Request)
- Method:
POST - URL:
https://api.freepik.com/v1/ai/text-to-image - Authentication: Generic → HTTP Header Auth
- Credentials: Select your "Header Auth account"
- Send Body:
true - Body Parameters:
- Name:
prompt - Value:
={{ $json.Prompt }}
- Name:
Split Responses (Split Out)
- Field to Split Out:
data - Purpose: Separates multiple images from API response
Convert to File (Convert to File)
- Operation:
toBinary - Source Property:
base64 - Purpose: Converts base64 image data to file format
Upload Image to Google Drive (Google Drive)
- Operation: Upload
- Name:
=Image - {{ $('Get Prompt from Google Sheet').item.json.Name }} - {{ $('Double Output').item.json.run }} - Drive ID:
My Drive - Folder ID: Your Google Drive folder ID (from Step 4)
- Credentials: Select your "Google Drive account"
Step 6: Customize for Your Use Case
- Modify Duplicate Count: Edit the "Double Output" code to create more variations
- Update File Naming: Change the naming pattern in the Google Drive upload node
- Adjust Batch Size: Modify the Loop node settings for your API limits
- Add Image Parameters: Enhance the HTTP request with additional Freepik parameters (size, style, etc.)
Step 7: Test the Workflow
- Ensure your Google Sheet has test data
- Click Execute Workflow on the manual trigger
- Monitor the execution flow
- Check that images are generated and uploaded to Google Drive
- Verify file names match your expected pattern
Step 8: Production Deployment
- Set up error handling for API failures
- Configure appropriate batch sizes based on your Freepik API limits
- Add logging for successful uploads
- Consider webhook triggers for automated execution
- Set up monitoring for failed executions
Freepik API Parameters
Basic Parameters:
prompt: Your text description (required)negative_prompt: What to avoid in the imageguidance_scale: How closely to follow the prompt (1-20)num_inference_steps: Quality vs speed trade-off (20-100)seed: For reproducible results
Example Enhanced Body:
{
"prompt": "{{ $json.Prompt }}",
"negative_prompt": "blurry, low quality",
"guidance_scale": 7.5,
"num_inference_steps": 50,
"num_images": 1
}
Workflow Flow Summary
- Start → Manual trigger initiates the workflow
- Read Sheet → Gets prompts and names from Google Sheets
- Duplicate → Creates multiple runs for variations
- Loop → Processes items in batches
- Generate → Freepik API creates images from prompts
- Split → Separates multiple images from response
- Convert → Transforms base64 to binary file format
- Upload → Saves images to Google Drive with organized names
- Complete → Returns to loop for next batch
Contact Information
Robert A Ynteractive
For support, customization, or questions about this workflow:
- 📧 Email: rbreen@ynteractive.com
- 🌐 Website: https://ynteractive.com/
- 💼 LinkedIn: https://www.linkedin.com/in/robert-breen-29429625/
Need help implementing this workflow or want custom automation solutions? Get in touch for professional n8n consulting and workflow development services.
Generate AI Images in Bulk with Freepik, Google Sheets & Drive
This n8n workflow automates the bulk generation of AI images using Freepik's API, driven by data from a Google Sheet, and then saves the generated images to Google Drive. It streamlines the process of creating multiple AI-generated visuals for various purposes like marketing, content creation, or product mockups.
What it does
- Triggers Manually: The workflow is initiated manually, allowing you to control when the image generation process begins.
- Reads Data from Google Sheets: It fetches a list of image prompts or other relevant data from a specified Google Sheet.
- Splits Data into Batches: The retrieved data is split into manageable batches, likely to handle API rate limits or process items efficiently.
- Generates AI Images via Freepik API: For each item in a batch, it makes an HTTP request to the Freepik API, sending the prompt to generate an AI image.
- Converts Image Data to File: The binary data of the generated image received from Freepik is converted into a file format.
- Saves Images to Google Drive: The generated image files are then uploaded and saved into a designated folder in Google Drive.
- Processes Remaining Items: The workflow continues to loop through the batches until all items from the Google Sheet have been processed and their corresponding images saved.
Prerequisites/Requirements
- n8n Account: A running n8n instance (cloud or self-hosted).
- Google Account: With access to Google Sheets and Google Drive.
- Google Sheets Credential: Configured in n8n to read from your spreadsheet.
- Google Drive Credential: Configured in n8n to upload files.
- Freepik Account & API Key: An active Freepik account with API access and a valid API key for image generation.
- HTTP Request Node Configuration: The HTTP Request node will need to be configured with your Freepik API endpoint and authentication (likely an API key in the headers).
Setup/Usage
- Import the Workflow: Download the provided JSON and import it into your n8n instance.
- Configure Credentials:
- Google Sheets: Set up or select an existing Google Sheets OAuth2 credential. Ensure it has access to the spreadsheet you intend to use.
- Google Drive: Set up or select an existing Google Drive OAuth2 credential. Ensure it has write access to the target folder.
- Configure Google Sheets Node (ID: 18):
- Specify the Spreadsheet ID and Sheet Name from which to read your image prompts.
- Ensure your sheet has a column containing the text prompts for AI image generation.
- Configure HTTP Request Node (ID: 19):
- Update the URL to the Freepik AI image generation API endpoint.
- Set the HTTP Method (likely POST).
- Configure Headers for API authentication (e.g.,
Authorization: Bearer YOUR_FREEPIK_API_KEY). - Set the Body to send the image prompt. You'll likely use an expression to pull the prompt from the incoming Google Sheets data (e.g.,
{{$json.promptColumnName}}).
- Configure Google Drive Node (ID: 58):
- Specify the Folder ID in Google Drive where the generated images should be saved.
- Set the File Name using an expression to create unique names (e.g.,
{{$json.promptColumnName}}.pngor{{$node["Google Sheets"].json["ColumnName"]}}.png).
- Activate the Workflow: Toggle the workflow to "Active" if you want it to run on a schedule (though this workflow is designed for manual execution).
- Execute the Workflow: Click "Execute Workflow" in the n8n editor to run it manually.
The workflow will then read your prompts, generate images, and save them to your Google Drive. You can monitor its progress and output in the n8n execution log.
Related Templates
Track meal nutrition from meal photos with LINE, Google Gemini and Google Sheets
AI Meal Nutrition Tracker with LINE and Google Sheets Who's it for This workflow is designed for health-conscious individuals, fitness enthusiasts, and anyone who wants to track their daily food intake without manual calorie counting. It is best suited for users who want a simple, AI-powered meal logging system that analyzes food photos one at a time and provides instant nutritional feedback via LINE. What it does This workflow processes a single meal photo sent via LINE, analyzes it using Google Gemini AI to identify foods and estimate nutritional content, and stores the data in Google Sheets for tracking. The workflow focuses on simplicity and encouragement: it receives a meal image, performs AI-based food recognition, estimates calories and macronutrients, calculates a health score, provides personalized advice, and replies with a detailed nutritional breakdown on LINE. How it works A single meal photo is sent to the LINE bot. The workflow is triggered via a LINE webhook. The image file is downloaded and sent to Google Gemini AI for food analysis. The AI identifies foods and estimates nutritional values (calories, protein, carbs, fat, fiber). A health score (1-10) is calculated with personalized improvement tips. The data is appended to Google Sheets for meal history tracking. The image is uploaded to Google Drive for reference. A formatted nutritional report with advice is sent back as a LINE reply. This workflow is intentionally designed to handle one image per execution. Requirements To use this workflow, you will need: A LINE Messaging API account A Google Gemini API key A Google account with access to Google Sheets and Google Drive A Google Sheets document with the following column names: Date Time Meal Type Food Items Calories Protein (g) Carbs (g) Fat (g) Fiber (g) Health Score Advice Image URL Important limitations This workflow does not support multiple images sent in a single message. Sending images in quick succession may trigger multiple executions and lead to unexpected results. Only the first image in an event payload is processed. Nutritional values are AI estimates based on visual analysis and typical serving sizes. Accuracy depends on image quality, lighting, and food visibility. This tool should not replace professional dietary advice. These limitations are intentional to keep the workflow simple and easy to understand. How to set up Create a LINE Messaging API channel and obtain a Channel Access Token. Generate a Google Gemini API key. Update the Config node with your LINE token, Google Sheets ID, Google Drive folder ID, and daily calorie goal. Configure credentials for LINE, Google Gemini, Google Sheets, and Google Drive. Register the n8n webhook URL in your LINE channel settings. Activate the workflow in n8n and test it with a single meal photo. How to customize Modify the AI prompt in the "Analyze Meal with AI" node to support different languages or dietary frameworks (keto, vegan, etc.). Adjust the daily calorie goal in the Config node to match individual needs. Add additional nutritional fields such as sodium, sugar, or vitamins. Replace Google Sheets with a fitness app API or database. Integrate with other services to send daily/weekly nutrition summaries. --- Note: This workflow was tested using real meal photos sent individually via the LINE Messaging API. Nutritional estimates are approximations and may vary from actual values. For accurate dietary tracking, consult a registered dietitian.
Track free Udemy courses automatically with RapidAPI and Google Sheets
This workflow fetches free Udemy courses hourly via the Udemy Coupons and Courses API on RapidAPI, filters them, and updates a Google Sheet. It sends alerts on errors for smooth monitoring. --- Node-by-Node Explanation Schedule Trigger: Runs the workflow every hour automatically. Fetch Udemy Coupons: Sends POST request to the Udemy Coupons and Courses API on RapidAPI to get featured courses. Check API Success: Verifies if the API response is successful; routes accordingly. Filter Free Courses: Selects only courses with sale_price of zero (free courses). Send Error Notification: Emails admin if API fetch fails for quick action. Sync Courses to Google Sheet: Appends or updates the filtered free courses into Google Sheets. --- Google Sheets Columns id name price sale_price image lectures views rating language category subcategory slug store sale_start --- Google Sheets Setup & Configuration Steps Create Google Sheet: Create or open a Google Sheet where you want to sync courses. Set Headers: Add columns headers matching the fields synced (id, name, price, etc.). Enable Google Sheets API: Go to Google Cloud Console, enable Google Sheets API for your project. Create Service Account: In Google Cloud Console, create a Service Account with editor access. Download Credentials: Download the JSON credentials file from the service account. Share Sheet: Share your Google Sheet with the Service Account email (found in JSON file). Configure n8n Google Sheets Node: Use the service account credentials, set operation to “Append or Update”, provide Sheet URL and sheet name or gid. Match Columns: Map the course fields to your sheet columns and set id as the unique key for updates. --- How to Obtain RapidAPI Key & Setup API Request Sign up/Login: Visit RapidAPI Udemy Coupons and Courses API and create an account or log in. Subscribe to API: Subscribe to the Udemy Coupons and Courses API plan (free or paid). Get API Key: Navigate to your dashboard and copy your x-rapidapi-key. Configure HTTP Request: In your workflow’s HTTP Request node: Set method to POST. URL: https://udemy-coupons-and-courses.p.rapidapi.com/featured.php Add headers: x-rapidapi-host: udemy-coupons-and-courses.p.rapidapi.com x-rapidapi-key: your copied API key Set content type to multipart/form-data. Add body parameter: page=1 (or as needed). Test API: Run the node to ensure the API responds with data successfully before continuing workflow setup. --- Use Cases & Benefits Automates daily updates of free Udemy courses in your sheet using the Udemy Coupons and Courses API on RapidAPI. Saves manual effort in tracking coupons and deals. Enables quick error alerts to maintain data accuracy. Ideal for course aggregators, affiliate marketers, or learning platforms needing fresh course data. --- Who This Workflow Is For Content curators and edtech platforms tracking free courses. Affiliate marketers promoting Udemy deals. Anyone needing real-time access to updated free Udemy coupons.
Daily Magento 2 customer sync to Google Contacts & Sheets without duplicates
Automatically sync newly registered Magento 2 customers to Google Contacts and Google Sheets every 24 hours — with full duplication control and seamless automation. This workflow is a plug-and-play customer contact automation system designed for Magento 2 store owners, marketers, and CRM teams. It fetches customer records registered within the last 24 hours (from 00:00:00 to 23:59:59), checks against an existing Google Sheet to avoid reprocessing, and syncs only the new ones into Google Contacts. This ensures your contact list is always fresh and up to date — without clutter or duplicates. ✅ What This Workflow Does: Automates Customer Syncing Every day, it fetches newly registered Magento 2 customers via API based on the exact date range (midnight to midnight). Deduplicates Using Google Sheets A master Google Sheet tracks already-synced emails. Before adding a customer, the workflow checks this list and skips if already present. Creates Google Contacts Automatically For each unique customer, it creates a new contact in your Google Contacts, saving fields like first name, last name, and email. Logs New Entries to Google Sheets In Google Sheets, it even records magento 2 customer group, createdat, websiteid & store_id After syncing, it adds each new email to the tracking sheet, building a cumulative record of synced contacts. Fully Scheduled & Automated Can be scheduled with the Cron node to run daily (e.g., 12:05 AM) with no manual intervention required. 🔧 Modules Used: HTTP Request (Magento 2 API) Date & Time (for filtering registrations) Google Sheets (for reading/writing synced emails) Google Contacts (for contact creation) Set, IF, and Merge nodes (for control logic) Cron (for scheduling the automation) 💼 Use Cases: Keep your email marketing tools synced with Magento 2 customer data. Build a CRM-friendly contact base in Google Contacts without duplicates. Share customer data with sales or support teams through synced Google Sheets. Reduce manual work and human error in data transfer processes. 🔒 Credentials Required Magento 2 Bearer Auth: Set up as a credential in n8n using your Magento 2 API access token. Google API 📂 Category E-commerce → Magento 2 (Adobe Commerce) 💬 Need Help? 💡 Having trouble setting it up or want to customize this workflow further? Feel free to reach out — I’m happy to help with setup, customization, or Magento 2 API integration issues. Contact: Author 👤 Author Kanaka Kishore Kandregula Certified Magento 2 Developer https://gravatar.com/kmyprojects https://www.linkedin.com/in/kanakakishore