Home / n8n Workflow Templates / Automate Video Uploads to Google Drive Using Google Apps Script

Automate Video Uploads to Google Drive Using Google Apps Script

Upload video to drive via google script

This workflow triggers manually, sends a video URL to a Google Apps Script web app to upload it to Google Drive, then renames the uploaded file.

Manual3 nodesProductivityGoogle DriveAutomationHTTP Request

About this workflow

Upload Video to Google Drive via Google Script Workflow

This N8n workflow template automates the process of uploading a video from a public URL to Google Drive using an external Google Apps Script web app, and then renaming the uploaded file within Google Drive. It demonstrates a practical integration between n8n, Google Drive, and custom serverless logic hosted on Google’s infrastructure.

What the Workflow Does

The workflow initiates upon manual trigger (e.g., clicking "Test workflow") and performs the following sequence:

  1. Sends a POST request containing a video URL and authentication secret to a Google Apps Script web application.
  2. The script runs externally to download the video from the provided URL and saves it directly into a configured Google Drive folder.
  3. Once the upload is confirmed, n8n proceeds to rename the newly uploaded file in Google Drive to a predefined name ("Music Video 1").

This enables automated cloud-based video ingestion without requiring direct file handling or large storage on intermediate systems.


Key Features and Capabilities

  • External Script Integration: Leverages Google Apps Script as a lightweight serverless function to handle file downloads and Drive uploads, reducing load on n8n.
  • Secure Communication: Uses a secret token (secret) to authenticate requests to the Google Script endpoint, preventing unauthorized access.
  • Automated File Management: Automatically renames files post-upload for consistency and organization.
  • Event-Driven Execution: Triggered manually, making it ideal for testing or on-demand operations.
  • Modular Design: Each step is encapsulated in a dedicated node, allowing easy modification and scalability.

Main Nodes and Their Purposes

  1. Manual Trigger Node

    • Node Type: n8n-nodes-base.manualTrigger
    • Purpose: Acts as the starting point of the workflow. When the user clicks “Test workflow,” this node activates the execution chain. Useful for debugging and controlled runs.
  2. HTTP Request Node – "Send URL to GDrive Script and Upload"

    • Node Type: n8n-nodes-base.httpRequest
    • Purpose: Sends a JSON payload via HTTP POST to a Google Apps Script web app. The payload includes:
      • videoUrl: Public URL of the video file to be downloaded.
      • secret: Authentication key to validate the request on the script side.
    • This node triggers the actual upload process outside of n8n.
  3. Google Drive Node – "Rename Uploaded Video"

    • Node Type: n8n-nodes-base.googleDrive
    • Operation: Update
    • Parameters:
      • fileId: Dynamically extracted from $json.driveUrl, which should be returned by the Google Script after upload.
      • newUpdatedFileName: Renames the file to "Music Video 1".
    • Credentials: Uses OAuth2 credentials linked to a Google Drive account.
    • Purpose: Finalizes the automation by organizing the uploaded content with a clean, consistent filename.

Use Cases and Benefits

Use Cases

  • Content Aggregation Platforms: Automatically import promotional videos, user-generated content, or media assets from third-party URLs into organized Drive folders.
  • Marketing Automation: Schedule or trigger video uploads for ad campaigns, social media posts, or internal reviews.
  • Backup & Archiving: Pull media files from remote sources and store them securely in Google Drive with standardized naming.
  • Integration Middleware: Bridge systems that generate video links (like recording tools or AI video generators) with Google Workspace environments.

Benefits

  • Efficiency: Eliminates manual downloading and uploading tasks.
  • Scalability: Can be extended to loop through multiple URLs or integrate with webhook triggers.
  • Security: Keeps sensitive scripts behind authenticated endpoints.
  • Flexibility: Easy to modify video source, destination names, or add further steps like sharing permissions or folder organization.

Step-by-Step Workflow Logic

  1. Start (Manual Trigger)
    → User manually starts the workflow by clicking "Test workflow".

  2. Send Request to Google Script
    → The HTTP Request node sends a POST request to "your_google_script_web_app_url" with the body:

    {
      "videoUrl": "https://example.com/path/to/your.mp4",
      "secret": "your-strong-secret-here"
    }
    

    → The Google Apps Script receives this, validates the secret, fetches the video, and uploads it to a specified Google Drive location.

  3. Receive File ID / URL (Implicit)
    → Although not explicitly shown in the current setup, the expectation is that the Google Script returns the fileId or driveUrl of the uploaded video in its response.
    → This value must be mapped to $json.driveUrl so the next node can use it.

  4. Rename the Uploaded File
    → The Google Drive node uses the received fileId (from ={{ $json.driveUrl }}) to update the metadata.
    → Changes the filename to "Music Video 1" using the update operation.

  5. Workflow Completion
    → The video now resides in Google Drive under the new name, fully automated.

⚠️ Note: For full functionality, ensure that the Google Apps Script returns the correct fileId or webViewLink in a format compatible with the fileId input field. You may need to adjust the output parsing using a Set node if the response structure requires transformation.


Conclusion

This workflow exemplifies how n8n can orchestrate interactions between external APIs and Google services efficiently. By offloading heavy lifting (like file transfer) to Google Apps Script and retaining control logic in n8n, users achieve a secure, scalable, and maintainable automation pipeline for managing video content in Google Drive.

How to use: download the JSON, then in n8n choose “Import from File”.