Bulk AI Video Generation from Google Sheets to Google Drive using Freepik API - n8n Workflow

Automate bulk video creation using prompts from Google Sheets and the Freepik Minimax Hailuo API. This powerful n8n workflow manages asynchronous polling and saves the resulting video files directly to Google Drive, providing scalable AI media generation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Content creation teams who need to scale video production quickly.
Marketers running large-scale campaigns requiring unique video assets.
Technical users looking for advanced n8n workflow examples involving API polling.
Anyone seeking pre-built n8n templates for AI-driven media automation.

Overview

Generating multiple AI videos from a list of prompts can be complex, especially since AI generation APIs are often asynchronous (requiring polling to check status). This powerful n8n workflow solves this by providing a robust, end-to-end automation solution. It begins by reading bulk video prompts from Google Sheets. Crucially, the n8n workflow uses a dedicated polling loop with a 'Wait' n8n node to handle the long processing times of the Freepik Minimax Hailuo API. Once a video is complete, the n8n template downloads the file and uploads it automatically to Google Drive, ensuring efficient resource management and reliable file storage. This complete n8n solution is perfect for high-volume content demands.

How it Works

This automation begins by using the Google Sheets n8n trigger/node to fetch all rows containing video prompts and associated metadata.


  1. Input & Duplication: The 'Get prompt from google sheet' n8n node reads the input data. A subsequent 'Code' n8n node, 'Duplicate Rows2,' duplicates each input item, ensuring two variations (Run 1 and Run 2) of the video are generated for every prompt.

  2. Batch Processing: The 'Loop Over Items' n8n node ensures that the API requests are processed sequentially or in small batches, managing rate limits effectively.

  3. Video Request: The 'Create Video' HTTP Request n8n node submits the prompt to the Freepik Minimax Hailuo API to initiate the AI video generation task.

  4. Asynchronous Polling: The 'Get Video URL' n8n node immediately polls the API using the task ID received in the previous step, checking the status.

  5. Flow Control: The 'Switch' n8n node analyzes the data.status response.

If the status is 'COMPLETED', the workflow proceeds to download.
If the status is 'IN_PROGRESS' or 'CREATED', the workflow routes to the 'Wait' n8n node (30 seconds), which then loops back to 'Get Video URL' to re-check the task status, successfully implementing the necessary polling loop in this n8n workflow.

  1. Download and Storage: Upon completion, the 'Download Video as Base64' n8n node fetches the video file. Finally, the 'Upload to Google Drive1' Google Drive n8n node saves the generated video to the designated Google Drive folder, using a dynamic naming convention that includes the original prompt name and the run number.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and import it directly into your self-hosted or cloud n8n instance.

  2. Google Sheets Setup: Configure the 'Get prompt from google sheet' n8n node by creating credentials for Google Sheets OAuth2 API. Ensure the Document ID matches your source spreadsheet containing the Prompt and Name columns.

  3. Freepik API Credentials: Configure an HTTP Header Auth credential for the Freepik API. This must include your API key necessary for the 'Create Video' and 'Get Video URL' HTTP Request n8n nodes.

  4. Google Drive Configuration: Set up OAuth2 API credentials for Google Drive. In the 'Upload to Google Drive1' n8n node, specify the target Drive ID and the exact Folder ID where the finished videos should be saved.

  5. Execution: After setting up all credentials and modifying the specific folder paths, you can activate and execute this powerful n8n template.

Node Details

Get prompt from google sheet (Google Sheets n8n node): Function: Reads prompt data from the specified Google Spreadsheet (e.g., Sheet1). Key Configuration: Uses OAuth2 credentials to read Prompt and Name columns.
Duplicate Rows2 (Code n8n node): Function: Duplicates each incoming item to request two unique video generations per prompt. Key Configuration: Simple JavaScript code adds a run property (1 or 2) to each duplicated item.
Loop Over Items (Split in Batches n8n node): Function: Manages flow control, iterating over each prompt variation generated by the previous n8n node before initiating the API call.
Create Video (HTTP Request n8n node): Function: Initiates the AI video generation process via the Freepik API. Key Configuration: POST request to the Minimax Hailuo endpoint, passing ={{ $json.Prompt }} as a body parameter.
Get Video URL (HTTP Request n8n node): Function: Polls the Freepik API using the generated task ID to check the video processing status. Key Configuration: GET request dynamically built with {{ $json.data.taskid }}.
Switch (Switch n8n node): Function: Directs the workflow path based on the video status (COMPLETED, IN
PROGRESS, etc.). Key Configuration: Conditions match ={{ $json.data.status }} against expected status strings.
Wait (Wait n8n node): Function: Pauses the execution for 30 seconds if the video is not ready, facilitating reliable asynchronous polling within this n8n workflow. Key Configuration: Wait Amount: 30.
Download Video as Base64 (HTTP Request n8n node): Function: Downloads the completed video file content once the generation is finished. Key Configuration: URL set to ={{ $json.data.generated[0] }}.


  • Upload to Google Drive1 (Google Drive n8n node): Function: Stores the final video in the target Google Drive folder. Key Configuration: Dynamic file name using inputs from the Google Sheet and the duplication step, ensuring traceability.

Related n8n Workflows

Free

Nodes: 8 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*