Transcribing Bank Statements To Markdown Using Gemini Vision AI n8n Workflow Template

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.

At a glance

Trigger
Manual Trigger (When clicking ‘Test workflow’)
Nodes
12
Apps
Google Gemini and Google Drive
AI nodes
4
Credentials
2 types
Category
Spreadsheets, databases and docs

Apps and integrations

  • Google Gemini
  • Google Drive

Node types used

  • Manual Trigger
  • Google Gemini Chat Model
  • Sort
  • Google Drive
  • HTTP Request
  • Compression
  • Code
  • Edit Image
  • Aggregate
  • Information Extractor
  • Basic LLM Chain

How it works

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.

Try Me Out!

This workflow converts a bank statement to markdown, faithfully capturing the details using the power of Vision Language Models ("VLMs"). The resulting markdown can then be parsed again by your standard LLM to extract data such as identifying all deposit table rows in the document.

This workflow is able to handle both downloaded PDFs as well as scanned PDFs. Be sure to protect sensitive data before running this workflow.

Need Help?

Join the Discord or ask in the Forum!

1. Download Bank Statement PDF

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

About the Example PDF

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!

2. Split PDF Pages into Seperate Images

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.

Privacy Warning!

This example uses a public third party service. If your data is senstive, please swap this out for the self-hosted version!

3. Convert PDF Pages to Markdown Using Vision Model

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.

Don't use Google?

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!

4. Extract Key Data Confidently From Statement

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.

Nodes in this workflow

The 12 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking ‘Test workflow’ (Manual Trigger)
  2. Google Gemini Chat Model (Google Gemini Chat Model)
  3. Sort Pages (Sort)
  4. Get Bank Statement (Google Drive)
  5. Split PDF into Images (HTTP Request)
  6. Extract Zip File (Compression)
  7. Images To List (Code)
  8. Resize Images For AI (Edit Image)
  9. Google Gemini Chat Model1 (Google Gemini Chat Model)
  10. Combine All Pages (Aggregate)
  11. Extract All Deposit Table Rows (Information Extractor)
  12. Transcribe to Markdown (Basic LLM Chain)

Credentials you need

  • Google Drive OAuth2 – used by Get Bank Statement
  • Google Gemini (PaLM) API – used by Google Gemini Chat Model and Google Gemini Chat Model1

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us