How to Build a Generic Agent to Process Any Excel File

Hi everyone! Hope you’re doing well.

I’m developing an agent to classify comments based on certain columns from Excel files. However, I’m facing a challenge: the files I receive come in very different formats.

For example, some files have columns like:

Grouped Source | Grouped Brand | Survey | Survey Score | Feedback

While others follow a format more like:

Response Date | NPS | BRAND_1 | BRAND_2 | BRAND_3 | BRAND_4 | BRAND_5 | Comment (History)

My question is:
Is it possible to create a single, generic agent that can automatically process and interpret different Excel file formats?

Also, what would be the best practice in this case: processing the file row by row or loading and handling the entire file at once?

Currently, I have to create a specific agent for each type of file, which isn’t scalable in the long run. I’d like to automate this process as much as possible.

If possible, could you help me with some pseudocode to better understand how to structure this?

Thanks in advance!

If you’re unsure which columns are relevant for your comment classification process, you can simply break it down into two steps:

  1. A first Agent (or a step in a Flow) takes a sample of 10 or 15 rows (initially with all columns), and you instruct it to identify which columns are relevant for classifying comments. This initial step should return a list of the relevant column names.
  2. Finally, the main Agent (or step) receives the data only from those relevant columns (determined in the previous step) and performs the classification, possibly in batches or chunks, depending on the volume of data you need to process.

Thanks for the response, Max. Could you provide me with an example of how this process would look based on my columns?

Based on the guidance provided, it’s now up to you to put it into practice and actually try to implement the solution. Use the framework’s documentation (at https://docs.crewai.com/) as a reference, as well as the wide variety of examples shared in the discussions on this forum.

After you’ve made a genuine attempt to implement a solution, if you’re still running into issues, you’ll need to provide your code and a concrete example so that the community members here can effectively help.

1 Like

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