AI Document Parser for Drive Files to CSV - n8n Workflow

Automate data extraction from PDFs and images in Google Drive using this powerful n8n workflow. Leverage Vertex AI (Gemini) and custom LLMs to output categorized CSVs.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Financial analysts and bookkeepers who handle numerous bank statements or receipts.
Businesses needing to digitize physical documents into structured data formats.
Technical users looking for advanced n8n templates integrating multimodal AI services.
Developers wanting to see a practical application of the LangChain n8n node with Vertex AI.

Overview

Manually extracting transaction data from unstructured documents like scanned bank statements or photographic receipts is time-consuming and error-prone. This specialized n8n workflow provides an autonomous solution, acting as a fully automated data pipeline. It starts with a crucial n8n trigger monitoring a specific Google Drive folder for new file uploads. By utilizing powerful n8n node capabilities, the automation intelligently routes files: PDFs are handled via OCR and a powerful external LLM (OpenRouter/Llama) for text extraction, while images are processed directly via Vertex AI (Gemini) multimodal analysis. This robust n8n template ensures that regardless of the input format, the resulting output is a clean, categorized CSV file saved back to Google Drive, dramatically minimizing manual data entry.

How it Works

The process begins with the Google Drive Trigger n8n node, acting as the primary n8n trigger, which constantly monitors a specified Google Drive folder for file creation events. Once a new file is detected, the n8n workflow uses the Route based on PDF or Image Switch n8n node to inspect the file's MIME type.

PDF Path:


  1. If the file is a PDF, the Download PDF Google Drive n8n node retrieves the binary file.

  2. The Extract data from PDF n8n node uses its built-in PDF operation to extract all embedded text.

  3. This extracted text is then sent via the Send data to A.I. HTTP Request n8n node to OpenRouter (using Llama 3.1) with a prompt instructing the AI to categorize the data (e.g., bank statement transactions) and return the output purely as raw CSV text.

Image Path:


  1. If the file is an image, the Download Image Google Drive n8n node retrieves the image binary.

  2. The file is sent to the Vertex A.I. extract text LangChain n8n node, which leverages the pre-configured Google Gemini Chat Model to perform multimodal recognition, extracting structured transaction data directly from the image.

Finalization:
Both paths conclude by converting the raw AI-generated CSV string into a proper file using the Convert to CSV n8n node. Finally, the Upload to Google Drive n8n node saves the processed and categorized CSV file into the designated output folder.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Google Drive Credentials: You need two sets of Google API credentials, preferably service accounts, for the Get PDF or Images n8n trigger and the Google Drive n8n node actions (Download/Upload).

  3. Google Drive Folder Setup: Create an input folder (watched by the n8n trigger) and an output folder (CSV Exports) in Google Drive. Configure the IDs in the respective n8n node parameters.

  4. Vertex AI Setup: Configure the Google Gemini credentials (associated with the Google Gemini Chat Model n8n node). Ensure Vertex AI is enabled on your Google Cloud project and the service account has the necessary permissions.

  5. OpenRouter Setup: Configure the Header Auth credential for the Send data to A.I. HTTP Request n8n node. The Header Name must be 'Authorization' and the Value must be 'Bearer {Your OpenRouter API Key}'.

  6. After setting credentials, activate the n8n workflow.

Node Details

Get PDF or Images (Google Drive Trigger): The initiating n8n trigger. Monitors a specific folder ID (1HOeRP5iwccg93UPUYmWYD7DyDmRREkhj) for the fileCreated event, ensuring the n8n workflow runs immediately upon upload.
Route based on PDF or Image (Switch): Core control-flow n8n node that uses the input item's mimeType ({{$json.mimeType}}) to route files to the PDF path (application/pdf) or the Image path (image/).
Extract data from PDF (Extract From File): A utility n8n node that uses the internal PDF processing operation to extract text content, preparing it for LLM analysis.
Send data to A.I. (HTTP Request): This n8n node sends the extracted PDF text to OpenRouter, prompting the meta-llama/llama-3.1-70b-instruct:free model to return transaction data formatted strictly as CSV.
Google Gemini Chat Model (LangChain LM): Provides the necessary API configuration for Vertex AI (Gemini). Used by the subsequent Vertex AI n8n node for multimodal processing.
Vertex A.I. extract text (LangChain Chain LLM): This advanced n8n node handles the image processing. It uses a multimodal prompt (messageType: imageBinary) to instruct Gemini 1.5 Pro to read transactions from the image and output the results as a categorized CSV.
Convert to CSV (Convert to File): An essential cleanup n8n node that takes the raw CSV text output by the AI models and converts it into a proper binary file ready for upload.
Upload to Google Drive (Google Drive): The final n8n node in the workflow, responsible for saving the generated CSV file (named by the current date {{$today}}) into the specified output folder (CSV Exports).

Related n8n Workflows

Free

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

I create automations with A.I. for SEO content and other smart automations.

Featured*