What This Workflow Does
This workflow watches a Google Drive folder for new PDF or image files.
It then extracts transaction text from these files.
After extracting, it uses AI to organize the data into CSV files with category tags.
The CSV files are saved back to Google Drive.
This helps remove slow manual data entry and speeds up financial reporting.
Who Should Use This Workflow
This workflow is useful for anyone handling many bank statements or receipts as PDF or image files.
Users who need fast, automated extraction and sorting of transaction data will benefit most.
No advanced technical skills are needed to run the workflow after setup.
Tools and Services Used
- n8n Automation Platform: Runs the workflow.
- Google Drive: Stores input documents and output CSV files.
- Google Cloud Vertex AI (Gemini model): Extracts text from images.
- Openrouter API: Parses PDF text via AI to CSV.
- Google Service Account: Grants n8n access to Google Drive and Vertex AI.
Inputs, Processing Steps, and Output
Inputs
- New PDF or image files uploaded to a specific Google Drive folder.
Processing Steps
- Detect new file in Google Drive folder.
- Identify if file is PDF or image using MIME type.
- If PDF, download and extract raw text from file.
- Send extracted PDF text to Openrouter AI for parsing into categorized CSV data.
- If image, download and send to Google Vertex AI (Gemini) to extract text.
- Use AI prompt to parse image text into categorized CSV format.
- Convert AI returned text into CSV file format.
- Upload CSV file to a specified Google Drive folder.
Output
- Structured CSV files with transaction data and assigned categories saved in Google Drive.
Beginner Step-by-Step: How to Use This Workflow in n8n
Importing and Setup
- Download the workflow file using the Download button on this page.
- Open your n8n editor (self-host or cloud-hosted).
- Click “Import from File” and select the downloaded workflow file.
- After import, add your Google Service Account credentials in the Google Drive Trigger and related Google Drive nodes.
- Enter Openrouter API Key credentials in the HTTP Request node for AI parsing.
- Update folder IDs, service account emails, or file paths in node settings if different from defaults.
- Check the AI prompt JSON in the HTTP Request node and copy/paste it exactly if needed:
- Test the workflow manually by uploading sample PDF and image files to the configured Google Drive input folder.
- Check the output folder for the generated CSV files.
{
"model": "meta-llama/llama-3.1-70b-instruct:free",
"messages": [{
"role": "user",
"content": "You are given a bank statement.{{encodeURIComponent($json.text)}}. Read the PDF and export all the transactions as CSV. Add a column called category and based on the information assign a category name. Return only the CSV data starting with the header row."
}]
}Activating for Production
- Toggle the workflow to “Active” in n8n.
- Keep the workflow running (cloud or self-host n8n) to ensure continuous file monitoring.
- Monitor workflow executions in the n8n dashboard for any errors.
Common Problems and Failures
- Google Drive Trigger does not detect new files.
Cause: Folder missing share permissions for service account.
Fix: Share the folder with the Google Service Account email with Editor rights. - HTTP Request node returns 401 Unauthorized.
Cause: API Key is missing or invalid in Openrouter’s HTTP Header Auth.
Fix: Update the API Key in credentials and test again. - Vertex AI fails to extract text from images.
Cause: Vertex AI API not enabled or service account lacks proper roles.
Fix: Enable Vertex AI API and assign roles in Google Cloud Console.
Customization Ideas
- Change the watched folder ID in Google Drive Trigger to any folder you want.
- Edit the AI prompt in the HTTP Request node to extract more details like merchant names.
- Add conditions in the Switch node to support TIFF or other file types.
- Insert Email nodes after uploads to send file processed alerts.
- Use Google Gemini models for PDF text parsing by replacing Openrouter with Vertex AI nodes.
Summary of Benefits and Results
✓ The workflow saves many hours weekly by removing manual entry.
✓ It reduces errors by letting AI categorize transactions.
✓ It puts clean CSV files automatically into Google Drive.
✓ It allows users to focus on analysis instead of data entry.
✓ The workflow is easy to set up and activate with no coding needed.

