Oh so close

Hi all,

So, I’ve just stared playing around with n8n and think I’m pretty close to getting my first automation working…

The idea is to watch a folder for new files - generally receipts, then OCR them using AI and drop the result into a csv file on the local machine.

It’s based on this template:

Everything is working so far until the final write to file…
the script is writing the cell headers each time, and also not starting a new line…

Any ideas what I need to fix to make this work?

I’m sure there are silly mistakes in there too, so feel free to let me know if there are better ways to do anything.

Also, the Vertex AI only seems to work with image files.
What is the best AI to use to OCR pdfs?

Thanks in advance!

Hey !

You could use the output parser in your AI node to specify the format you want.

For the headers, make sure you don’t have the headers in your Convert To CSV2 node, this is the only thing I can think of looking at your workflow.

For the newlines, try putting \n directly in your last read/Write node, like this :
{{ $('Code').item.json[\"Invoice Date\"] }},{{ $('Code').item.json[\"Invoice Number\"] }},...\n"

For the OCR for pdfs, Mistral just launched one of the best model for OCR, didn’t try it but it seems really good ! Mistral OCR | Mistral AI

Hope this helps ! :slight_smile: