n8n workflow template · 12 nodes · Google Gemini
Transcribing Bank Statements To Markdown Using Gemini Vision AI is a free n8n workflow template that starts when you run it manually in the n8n editor and works with Google Gemini and Google Drive. It has 12 nodes, 4 of them AI nodes (Google Gemini Chat Model, Information Extractor and Basic LLM Chain). The notes inside the workflow say: “This workflow is able to handle both downloaded PDFs as well as scanned PDFs. Be sure to protect sensitive data before running this workflow.” To run it, you add your own credentials for Google Drive OAuth2 and Google Gemini (PaLM) API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
This workflow is able to handle both downloaded PDFs as well as scanned PDFs. Be sure to protect sensitive data before running this workflow.
Join the Discord or ask in the Forum!
Read more about Google Drive node
For this demonstration, we'll pull an example bank statement off Google Drive however, you can also swap this out for other triggers such as webhook.
You can use the example bank statement created specifically for this workflow here
Scanned PDFs (ie. where each page is a scanned image) are a use-case where extracting PDF text content will not work. Vision models are a great solution as this workflow aims to demonstrate!
Currently, the vision model we'll be using can't accept raw PDFs so we'll have to convert our PDF to a image in order to use it. To achieve this, we'll use the free Stirling PDF webservice for convenience but if we need data privacy (recommended!), we could self-host our own Stirling PDF instance instead. Alternatively, feel free to swap this service out for one of your own as long as it can convert PDFs into images!
We will ask the PDF service to return each page of our statement as separate images, which it does so as a zip file. Next steps is to just unzip the file and convert the output as a list of images.
This example uses a public third party service. If your data is senstive, please swap this out for the self-hosted version!
Learn more about using the Basic LLM node
Unlike traditional OCR, vision models ("VLMs") "transcribe" what they see so while we shouldn't expect an exact replication of a document, they may perform better making sense of complex document layouts ie. such as with horizontally stacked tables.
In this demonstration, we can transcribe our bank statement scans to markdown text for the purpose of further processing. With markdown, we can retain tables or columnar data found in the document. We'll employ two optimisations however as a workaround for token and timeout limits (1) we'll only transcribe one page at a time and (2) we'll shrink the pages just a little just enough to speed up processing but not enough to reduce our required resolution.
Feel free to swap the model out for any state-of-the-art multimodal model which supports image inputs such as GPT4o(-mini) or Claude Sonnet/Opus. Note, I've found Gemini to produce the most accurate and consistent for this example use-case so no guarantees if you switch!
Read more about the Information Extractor
With our newly generated transcript, let's pull just the deposit line items from our statement. Processing all pages together as images may have been compute-extensive but as text, this is usually no problem at all for our LLM.
For our example bank statement PDF, the resulting extraction should be 8 table rows where a value exists in the "deposits" column.
The 12 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us