Automate PDF to CSV Conversion: The n8n Method That Saved Me 15 Hours/Week

Here is a meta description for the article: “Learn how to extract PDF and image text into CSV using n8n and OpenAI, automating tedious tasks and saving time. A step-by-step guide to building a workflow that turns files into structured data.”

🔒  I use this workflow to extract transaction data from my bank PDF and screenshots for budgeting.

🔒  The process involves setting up a workflow with nodes such as Read Binary Files, A.I., and CSV, and configuring the OpenAI node with a specific prompt to extract the desired data.

🔒  Learn how to use Google’s Vertex for image recognition.

I use actual budgeting to budget all my money. Every month, I upload my bank statements into chatGPT and then ask it to give me a csv file. It’s nice but I have 45+ different statements and screenshots I need to upload to A.I. It ends up taking up an hour of my time.

Then I found a way to automate this tedious task using n8n and Google Vertex AI. Now, I just drop my files into a folder and get perfectly formatted CSV files in seconds. You can use this to extract your transactions for other budgeting software or you can use the flow to extract any other type of text from PDF and images.

Click on the above image to download my n8n workflow. If you’ve got an ad blocker, turn it off to get it.

How it works

  1. You upload a PDF or image into a google drive folder.
  2. n8n looks at the document type and then splits the flow into PDF or image.
  3. If it’s a PDF, extract the text and send to A.I.
  4. If it’s an image, send it to Vertex AI to extract the content. Send to A.I.
  5. A.I. returns the CSV output

What You’ll Need

Here’s your shopping list:

  • An n8n account (cloud or self-hosted)
  • Vertex AI API
  • Some PDFs or images with text
  • Google drive account
  • 15 minutes of setup time

Setting Up Your Environment

  1. Sign up for n8n cloud or install it locally
  2. Get your OpenAI API key from platform.openai.com
  3. Create a new n8n workflow
  4. You need to create a Google drive folder for uploading your files
  5. You need another google drive folder for the CSV output

Quick tip: Test your OpenAI API key with a simple “hello world” prompt before diving in.

What it looks like

What’s next?

This basic template allows you to modify it to do alot of other things.

You can use this same workflow for:

  • Processing invoices
  • Organizing receipts
  • Extracting data from forms
  • Archiving documents

You can even automate the importing the CSV into your favorite accounting software. All you need to do is to watch the google output drive folder and then action on new items coming in.

The main thing is to modify the A.I. prompt:

You are given a screenshot of payment transactions. Read the image 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.

Leave a Reply

Your email address will not be published. Required fields are marked *