Rename Japan e-bookkeeping receipts and invoices with Gemini and Google Drive

Go to Workflow
7 views
Built by 池田 誠 池田 誠
Created on August 02, 2026

Description

Quick overview
Helps Japanese businesses digitizing paper invoices and receipts under Japan's Electronic Bookkeeping Act. Files in a Google Drive INPUT folder are read with Google Gemini OCR, then copied to OUTPUT with a compliant searchable filename (date_partner_amount_type) or to SKIP for human review. Originals are never modified.

How it works
Runs manually to start processing.
Lists up to the configured maximum number of files in a Google Drive INPUT folder and iterates through them one at a time.
Downloads each file from Google Drive, detects its MIME type, base64-encodes the content, and prepares a Gemini request payload.
Sends supported images and PDFs to the Google Gemini generateContent API to extract document count, transaction date, partner, amount, and document type as JSON.
Builds a compliant filename in the format YYYYMMDD_partner_amount_type.ext when the response indicates a single valid document with required fields.
Copies the original file to a Google Drive OUTPUT folder using the new filename, or copies it to a SKIP folder unchanged when the file type is unsupported or the extraction is ambiguous (non-document/multiple documents/missing fields).

Setup
Create three Google Drive folders for INPUT, OUTPUT, and SKIP, then paste their folder IDs into the configuration step and set the per-run maxFiles value.
Add a Google Drive OAuth2 credential and select it in all Google Drive steps.
Add your Google Gemini API key (from Google AI Studio) to the x-goog-api-key header in the Gemini HTTP request step.
Place invoices/receipts (supported: PDF, JPG/JPEG, PNG, WEBP, HEIC/HEIF, TIFF) into the INPUT folder and run the workflow.

Requirements
A Google Drive account and credential
A Google Gemini API key from Google AI Studio

Customization
Change maxFiles in the Config node to process more files per run
Edit the Gemini prompt to extract additional fields
Enable Retry On Fail on the Gemini node to absorb temporary rate limits

Nodes Used (3)

Code
n8n-nodes-base.code
Google Drive
n8n-nodes-base.googleDrive
HTTP Request
n8n-nodes-base.httpRequest