Image Transfer and Resizing for Google Docs Automation - n8n Workflow

Use this powerful n8n workflow to automate image retrieval from Google Drive, including dynamic resizing and sorting, for bulk insertion into Google Docs. A highly efficient n8n template.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

-
Content creators and documentation specialists needing to compile large documents with dynamically sized images.
Users managing high volumes of visual assets stored in Google Drive.
Technical professionals seeking a sophisticated n8n workflow example utilizing custom scripting for API payload generation.
Anyone looking for robust n8n templates for cloud storage and document manipulation.

Overview

Managing large documentation projects that require numerous images can be tedious and prone to formatting errors. This specialized n8n workflow solves this by providing a fully automated solution to retrieve, sort, size, and insert images from a designated Google Drive folder directly into a Google Docs document. This n8n automation leverages the Google Docs batchUpdate API via an HTTP Request n8n node, allowing for precise control over image dimensions (resizing 'thumb' images differently than main images) and insertion location. This high-efficiency n8n template incorporates wait timers and batch processing to handle large datasets reliably, ensuring that the n8n execution does not time out during heavy operations. This is a crucial n8n workflow for anyone seeking reliable, scalable document generation.

How it Works

The n8n workflow initiates using a manual n8n trigger for immediate execution.


  1. Retrieve Files: The workflow starts by using the Google Drive n8n node to search and retrieve a list of image files (metadata) from a specified Google Drive folder ID.

  2. Staged Processing: A series of Wait n8n node components are used throughout the flow to manage request rates and prevent API timeouts, especially when dealing with numerous files.

  3. URI Generation & Sorting: A Code n8n node (Filtering URI) takes the file metadata. It dynamically sorts the files based on a numeric value found within the filename (e.g., Image-001, Image-002) in descending order. Crucially, it constructs a public view URI for each image using the file ID, which is necessary for Google Docs insertion.

  4. Dynamic Resizing & Payload Creation: Another Code n8n node (Resize Image) evaluates the file name. If the name contains 'thumb', it sets a smaller size (200x150 PT); otherwise, it defaults to a larger size (400x250 PT). It then generates the precise JSON payload required for the Google Docs batchUpdate API, defining the image URI, size, and insertion index.

  5. Batch Insertion: The payload items are routed through the Split In Batches n8n node (Loop Over Items), which acts as a reliable loop controller. This ensures that the bulk update requests are sent in manageable batches to the Google Docs API.

  6. Execute Update: Finally, an HTTP Request n8n node (Insert Image to Google Doc), authenticated with Google Docs credentials, sends the batched resizing and insertion requests to the Google Docs API, finalizing the document update for this powerful n8n workflow.

Installation Guide

This n8n template requires setup for Google Drive and Google Docs API access.


  1. Import: Import this n8n workflow JSON into your n8n instance.

  2. Google Drive Credentials: Create or select your Google Drive OAuth2 API credential. Ensure it has access to the folder containing your source images.

  3. Google Docs Credentials: Create or select your Google Docs OAuth2 API credential. This is used by the Insert Image to Google Doc HTTP Request n8n node.

  4. Configure Search File: In the Search File in Google Drive n8n node, replace the placeholder folder ID with the ID of the Google Drive folder containing your images.

  5. Configure Document ID: In the Insert Image to Google Doc n8n node (HTTP Request), update the URL to include your specific target Google Docs Document ID: https://docs.googleapis.com/v1/documents/{{YOURDOCUMENTID}}:batchUpdate.

  6. Execution: After credential setup, execute the n8n trigger to run the n8n workflow.

Node Details

When clicking ‘Execute workflow’ (Manual Trigger): The starting n8n node. Initiates the entire n8n workflow upon manual user execution.
Search File in Google Drive (Google Drive n8n node): Function: Retrieves metadata for all files within the configured Google Drive Folder ID. Key Configuration: Resource: fileFolder, Return All: true.
Filtering URI (Code n8n node): Function: Sorts the image items based on a numeric value in the filename (descending order) and constructs the publicly accessible Google Drive URI for image embedding.
Resize Image (Code n8n node): Function: Dynamically determines the required image dimensions (width/height in PT) based on whether the filename contains 'thumb'. It generates the complex requests array payload specifically formatted for the Google Docs API batchUpdate endpoint.
Loop Over Items (Split In Batches n8n node): Function: Manages the flow control, batching the insertion requests to ensure reliable processing of many images without hitting API limits or causing the n8n workflow to time out.
Insert Image to Google Doc (HTTP Request n8n node): Function: Sends the batch update request to the Google Docs API to insert the pre-sized, pre-formatted inline images into the specified document. Key Configuration: Uses Google Docs OAuth2 credentials, method POST, and targets the batchUpdate endpoint.

Related n8n Workflows

Free

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

Security Analyst with expertise in penetration testing, threat detection, and AI-driven automation. Experienced in securing systems, identifying vulnerabilities, and building proactive security solutions. Focused on leveraging technological innovation to create safe and efficient digital environments.

Featured*