How to read a custom group of files from a folder (Excel Reader or Csv Reader)

Hi friends

Imagine the following scenario:

In a folder, I have three files with the same layout, but each belong to different companies. I know that I could configure the “CsvReader” to read the folder, and the node would automatically group all the files, meaning it would read all three files at once. (Print 1)

print 1

files in folder
image

The initial number are the companies “code”

However, imagine that I want to configure it to read only two files from the folder instead of all three. In other words, I want to create a custom group and specify only the two files I want to read.

I know that in the Csv Configuration exists a Filter option to filter by file name.
But I need to filter “one” or “more” files, bases in the group definition.

Here’s the model I’m creating:

Step 1) I created an Excel file containing all existing company codes and a column defining which ones will be part of the reading group. (Print 2)

image
image

This column is the group by companies to use “like” a group loop.
image

Step 2) I used the “List Files/Folders” node to read all the files in the folder so I could identify their names and perform a JOIN to bring in the group column.

This shows 3 files and the group column

Then I use a group loop node to loop by group
Now I have only two files to read and append on reading :ok_hand:
image
image

But here’s is the step that I’m stuck.
How to read only the two files if my configuration window requires using a variable to read the folder and filter the desired files?
My expectation is for the result to show only two files, read them, and then start another group until the end.

It’s possible?

workflow until here
image

@Felipereis50 use the file names or parts of them (company code) and then a loop.

1 Like

@mlauber71

Even so, I didn’t understand.

I can loop through each file, but the problem is looping through a group of items in the same folder and using the Excel append feature.

But you gave me an idea :bulb:—using the append node instead of doing it inside the Excel node.

I will come back

@Felipereis50 the loop end node can collect the results. You might have to use two nested loops on a folder. One per company and then one collecting the Excel files of the company.

Key to these things is planning.

I didn’t think it through.

(The funniest part is that I use Group Loop a lot and focused on grouping with the CSV node, but the Loop End does the same.)

I changed my workflow and am now using Group Loop with Loop End, and the result is the same.

Thanks for the “idea”!

2 Likes

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