Can we pass variable number of files to the agent?

Hi Team,

I have a scenario where the agent reads the data from input string(email body) provided to the agent. There might be cases where the agent has to read the data from the unstructured (there is no template as such) .xlsx or .csv attachments(sometimes one and in some case more than 1).

So will it be possible to build the agent for dynamic file input for the agent to extract data from those ?

@abhilashmohanty86

Analyze files can help there..but they might not support excel or csv…you can read csv as text and pass it or save as text file and send to analyze..excel can be saved as pdf and sent to analyze file in agents

cheers

@abhilashmohanty86

Yes, it should be possible by defining the agent input as an Array of File, so you can pass one or multiple attachments dynamically.

However, for .xlsx or .csv, it is better to use an RPA workflow/tool to read the files first, loop through all attachments, extract the content, and then pass the extracted text/JSON to the agent.

So the recommended approach is:

Email body → Agent input
Attachments → Array of File → RPA workflow reads CSV/XLSX → send extracted content back to agent

The agent can then process the email body plus the extracted attachment data.

@ravindra.reddy33 ,

for the excel and csv attachment the users don’t use any specific template. So in this case, how can I read the data of excels to feed into the agent ?

Hi @abhilashmohanty86

Yes, you can handle this using a dynamic approach.

First, use Read Range or Read CSV to load the file into a DataTable without assuming structure. Then, inspect columns at runtime using For Each Column in Data Table to identify relevant headers or patterns. For fully unstructured data, use For Each Row with condition checks and Regex to extract values based on keywords instead of fixed columns.

If files vary a lot, use Document Understanding (Digitize Document, Data Extraction Scope) to classify and extract fields dynamically.

Happy Automation

For handling csv there is a native tool inside the agent builder - Batch Transform (link). You can try this to handle csv files.
The second approach to handle csv/excel would be to read as data table, convert to a json (Newtonsoft.Json.JsonConvert.SerializeObject(YourDataTableVariable) or string and pass to the agent.