Hello everyone,
I’ve built a workflow where I upload an invoice as a PDF file. The file goes through an OCR API to extract the data, then through an AI agent, and finally the extracted information is saved into Google Sheets.
Everything works perfectly when I upload a single file. However, when I upload multiple files, they get renamed as invoice_0
, invoice_1
, etc., which causes an error because the OCR API only accepts files named exactly invoice.
My question is:
How can I create a loop that processes multiple uploaded files one at a time, while temporarily renaming each file to invoice before sending it through the workflow? Once the first file finishes processing, the next file should be renamed to invoice and go through the same workflow — and so on, sequentially.