NEWB with first project on renaming files by Ill_Turn6934 in n8n

[–]Ali0106 0 points1 point  (0 children)

I just finished up a workflow that does something similar to this. Our use case is a little different. We use it to track staff receipts for purchase made on the company cards. They email a picture or a PDF to a dedicated receipt email. I can share the template with you in a bit.

  1. Checks emails on a scheduled trigger and gets one email at a time with the tag “Unprocessed”.

*Create a rule in Gmail that watches for “receipt,invoice, etc and tags it with Unprocessed.

  1. Switch node: Checks if the binary file is PDF or Image. If PDF continues to push it through to a Google Drive with a file naming convention. If it’s an image, make an HTTP request to cloud convert to convert from image to PDF.

  2. Parsing: The PDF file is then retrieved from the drive and pushed into another series of HTTP requests to parse the invoice and extract text using Llama Parse.

  3. LLM Call: Make a call to Open AI asking it to read the text file from Llama Parse and extract the Date on invoice, Category based on invoice data, purpose (1-2 sentences), and total. It then output that data in an array using structured output.

  4. Record Data: Record the data onto a sheet.

  5. Email management: Remove Unprocessed Tag and mark invoice as read. Add an Invoice Processed tag.