Skip to main content
Community template Uses AIDocument ExtractionMultimodal AI

Process large documents with OCR using SubworkflowAI and Gemini - n8n workflow template

Document workflows are popular ways to use AI but what happens when your document is too large for your app or your AI to handle? Whether its context window or application memory that's grinding to a halt, Subworkflow.ai is one approach to keep you going. Subworkflow.ai is a…

Template by Jimleuk · Original listing (opens in a new tab)

Starts on
App event
Nodes
10 nodes
Level
Intermediate
Setup
About 20 min

Workflow preview

How this workflow runs

  1. 1

    When clicking ‘Execute workflow’

    Starts the workflow manually when you click 'Execute workflow' — used for testing and manual runs.

  2. 2

    Download file

    Uploads, downloads, or manages files in Google Drive.

  3. 3

    Extract API

    Makes an external API call (HTTP request) to send or retrieve data from a third-party service.

  4. 4

    Job Complete?

    Branches the workflow based on a true/false condition.

  5. 5

    Get Dataset

    Makes an external API call (HTTP request) to send or retrieve data from a third-party service.

  6. 6

    Check Job Status

    Makes an external API call (HTTP request) to send or retrieve data from a third-party service.

  7. 7

    Get Dataset Items

    Makes an external API call (HTTP request) to send or retrieve data from a third-party service.

  8. 8

    Wait

    Pauses the workflow for a set time or until a condition is met (used for polling / async jobs).

  9. 9

    Split Out

    Splits an array field into individual items so each can be processed separately.

  10. 10

    Document OCR via VLM

    Calls Google Gemini for text, vision, or audio generation.

Creator's notes and setup

Written by Jimleuk for the original listing.

Working with Large Documents In Your VLM OCR Workflow

Document workflows are popular ways to use AI but what happens when your document is too large for your app or your AI to handle? Whether its context window or application memory that's grinding to a halt, Subworkflow.ai is one approach to keep you going.

> Subworkflow.ai is a third party API service to help AI developers work with documents too large for context windows and runtime memory.

Prequisites

  1. You'll need a Subworkflow.ai API key to use the Subworkflow.ai service.
  2. Add the API key as a header auth credential. More details in the official docs https://docs.subworkflow.ai/category/api-reference

How it Works

  1. Import your document into your n8n workflow
  2. Upload it to the Subworkflow.ai service via the Extract API using the HTTP node. This endpoint takes files up to 100mb.
  3. Once uploaded, this will trigger an Extract job on the service's side and the response is a "job" record to track progress.
  4. Poll Subworkflow.ai's Jobs endpoint and keep polling until the job is finished. You can use the "IF" node looping back unto itself to achieve this in n8n.
  5. Once the job is done, the Dataset of the uploaded document is ready for retrieval. Use the Datasets and DatasetItems API to retrieve whatever you need to complete your AI task.
  6. In this example, all pages are retrieved and run through a multimodal LLM to parse into markdown. A well-known process when parsing data tables or graphics are required.

How to use

  • Integrate Subworkflow's Extract API seemlessly into your existing document workflows to support larger documents from 100mb+ to up to 5000 pages.

Customising the workflow

  • Sometimes you don't want the entire document back especially if the document is quite large (think 500+ pages!), instead, use query parameters on the DatasetItems API to pick individual pages or a range of pages to reduce the load.

n8n nodes used (7 types)

What every node does (10)
  • Wait (Wait)Pauses the workflow for a set time or until a condition is met (used for polling / async jobs).
  • Check Job Status (HTTP Request)Makes an external API call (HTTP request) to send or retrieve data from a third-party service.
  • Get Dataset Items (HTTP Request)Makes an external API call (HTTP request) to send or retrieve data from a third-party service.
  • Get Dataset (HTTP Request)Makes an external API call (HTTP request) to send or retrieve data from a third-party service.
  • When clicking ‘Execute workflow’ (Manual Trigger)Starts the workflow manually when you click 'Execute workflow' — used for testing and manual runs.
  • Download file (Google Drive)Uploads, downloads, or manages files in Google Drive.
  • Split Out (Split Out)Splits an array field into individual items so each can be processed separately.
  • Extract API (HTTP Request)Makes an external API call (HTTP request) to send or retrieve data from a third-party service.
  • Job Complete? (If)Branches the workflow based on a true/false condition.
  • Document OCR via VLM (Google Gemini)Calls Google Gemini for text, vision, or audio generation.

FAQ

Process large documents with OCR using SubworkflowAI and Gemini: questions

How do I import the "Process large documents with OCR using SubworkflowAI and Gemini" workflow into n8n?

Copy the workflow JSON from this page, open the n8n editor, click on an empty canvas and paste with Ctrl+V (Cmd+V on macOS). You can also download the .json file and choose Import from File in the workflow menu. Save the workflow, then attach credentials before activating it.

Which nodes and credentials does "Process large documents with OCR using SubworkflowAI and Gemini" use?

It uses HTTP Request, If, Google Drive, Wait, Manual Trigger and Split Out, plus 1 more. Any node that connects to an external service needs your own credential — open each node after import and select or create one. Trigger, logic and transformation nodes usually need no credentials.

Can it run on n8n Cloud and on self-hosted n8n?

The workflow format is the same on both. If a node appears as unknown or outdated after import, update n8n to a recent version or, on self-hosted instances, install the required community node package. Features such as $env access are available on self-hosted instances only.

How can I customise "Process large documents with OCR using SubworkflowAI and Gemini"?

Start by changing the trigger (schedule, webhook or app event) and the destination nodes to match your stack — it is listed under Document Extraction, Multimodal AI. Edit prompts, field mappings and filters in the relevant nodes, use expressions like {{ $json.field }} to map data, and test with a manual execution before activating.

n8n is a trademark of n8n GmbH. AltFTool is not affiliated with, endorsed by or sponsored by n8n. Community templates are credited to their creators and link to the original listing; AltFTool originals are written and tested by the AltFTool team.

About this page

Free n8n workflow templates to copy and import

The AltFTool n8n library collects free n8n workflow templates for AI agents, Gmail, Google Sheets, Telegram and other apps. Each workflow page shows a preview, the list of nodes and the credentials it needs, and lets you copy or download the JSON to import into your own n8n.

Search the templates by app or task, or browse them by category and by node. The Workflow Inspector checks any workflow JSON for triggers, credentials and hardcoded keys before you share it, and the expressions cheat sheet gives copy-paste n8n expression examples. AltFTool is not affiliated with n8n.

People also search for

  • n8n workflow templates
  • n8n templates
  • n8n automation examples
  • n8n json workflows
  • n8n nodes
  • free n8n workflow templates
  • n8n ai agent template
  • n8n expressions cheat sheet