How to batch submit scanned invoices and extract the fields in to excel

Describe the problem/error/question

I am a beginner with n8n.
I would like to create a workflow to handle company staff travel expense claim reimbursements.

Details:

  • Staff will scan invoices that include meals, transportation, taxi, and hotel receipts in PDF or image format.
  • Staff will submit them in batches (I assume using the ‘n8n Form’ node).
  • The workflow should use Gemini and Mistral OCR to extract information and write it to a predefined Excel or Google Sheet. The fields include: company name, currency, invoice date, invoice number, and total amount.

I’ve watched many YouTube videos and explored n8n templates, but I still don’t fully understand how to design the workflow.

I believe the workflow should include:

  1. A trigger for form submission to upload multiple scanned invoices
  2. Splitting the JSON
  3. Looping over each item to handle files one by one
  4. Three HTTP requests for Mistral OCR
  5. An AI Agent to extract structured information
  6. Writing the extracted data into predefined fields in Google Sheets

Would you mind reviewing my design and sharing any suggestions or templates for reference?

I appreciate your help and apologize for my limited knowledge.

Thanks

AW

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): Local docker
  • **Operating system: window 11

It could start with something like this:

then connect whatever you see fit to OCR - Gemini / Analyze image for images and Mistral OCR for pdfs.

Hi Supporter

Thanks so much for your suggestion! I followed the steps, but I still don’t fully understand how it works. Below is the output JSON after the ‘on form submission’ trigger. Based on this input JSON, what JavaScript should I use for the second node?

[
{
“File Type”: [
{
“filename”: “screenshot-1.pdf”,
“mimetype”: “application/pdf”,
“size”: 410150
},
{
“filename”: “image (18b).jpg”,
“mimetype”: “image/jpeg”,
“size”: 48652
},
{
“filename”: “Image (19).jpg”,
“mimetype”: “image/jpeg”,
“size”: 1308505
},
{
“filename”: “image (21).png”,
“mimetype”: “image/png”,
“size”: 1707294
},
{
“filename”: “Image (18).jpg”,
“mimetype”: “image/jpeg”,
“size”: 1795191
},
{
“filename”: “Sales_Invoice_Example.png”,
“mimetype”: “image/png”,
“size”: 32716
}
],
“submittedAt”: “2025-08-05T21:58:24.415-04:00”,
“formMode”: “test”
}
]

Could you instead share your workflow?

Yes. below are the workflows that include the javascript. Thanks

I am not sure how exactly you “followed the steps”, but this has nothing to do with my workflow :slight_smile:

You don’t really care about the JSON, you need binaries. See my example again and grab the binaries instead.

The error you see

A ‘json’ property isn’t an object [item 0]

has the answer in it. ‘json’ property needs to be an object, but it is an array (because the input to the code node is an array).

Thanks information.

Sorry I am completely NO CODE user. Honestly, i have no idea about the message

A ‘json’ property isn’t an object [item 0]

As mentioned, i just copy and modify the n8n template

The template is work for multiple invoice upload and that why i copy from it.

Would you mind give me a bit details how to fix it?

Thanks in advance

Regards

Andy

Sure, I can write the code, but to make sure I understand what you need to achieve in this code node, please tell me what is the expected output from this node.

Hey @andyw thank you for this explanation, but I was asking what do you expect the Code node to output after running the code in it?

Hi Support

Sorry for my limited knowledge, I believe it should be array because the original workflow is array output, right?

Thanks

AW

I don’t know, this is your workflow :slight_smile:
Only you can know what is right for it

Hi Support

Sorry for my limited knowledge. I would like the code node to output array. Thanks

Regards

AW

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.