Automatically process invoices and export to Google Sheets using OpenRouter.ai

Hi,

Here is my first success, but it took some customizing.

Overview of the process:

  1. Upload a picture of an invoice to a specific folder in Google Drive.
  2. Trigger the workflow.
  3. Read the specific folder in Google Drive to check for new files.
  4. If there are files, analyze them using the model google/gemini-flash-1.5-8b on Openrouter.ai.
  5. Parse the data into JSON format.
  6. Take the JSON data and dynamically place it in the appropriate sheet based on the month of the invoice.
  7. Move the file from the initial folder and classify it into the correct folder (month of the invoice).
  8. Create a second backup of the invoice in case we accidentally delete it.

Here is the workflow :

I will revise the post based on the feedback received. If appropriate, I will include the code for my node, although I am uncertain if this is the correct venue as I am not a developer here.

I encountered some challenges with the existing node, which led me to implement several features:

  • Retrieving a file from a specified folder in Google Drive
  • Integrating OpenRouter.ai API ( enabling me to use gemini-flash-1.5-8b but i can change on demand between all provider quickly )
  • Inserting a header in a Google Sheet dynamically based on the month
  • Transferring the file to a dynamic folder within Google Drive.

An amusing discovery I made while constructing the workflow was that the openrouter node kept reporting a nonexistent file. This issue arose because the node I had customized to retrieve files from a specific folder was also detecting files that had been deleted (and were in the trash), so I had to permanently delete the trash files in my Google Drive to resolve the problem.

1 Like

Hey, this is nice! Thanks so much for sharing your case study—we really appreciate it! Regarding invoice processing, I’ll soon be sharing a great scenario that you can replicate as well.

By the way, you might also find this post interesting. It covers a similar case that touches on working with invoices: Extracting Text from a .txt File and Any Document.

From the converted file, you can use AI to extract JSON data and organize it into the required tables.

Hope you find it interesting! :v:

1 Like

Thank you very much! I will definitely check this out. Additionally, I plan to invest my spare time in conducting case studies on various topics.

1 Like