How to read multiple CSVs from a folder having their file name as one of the columns.

Hi Everyone,

I’m trying to read multiple CSVs from a folder having their file name as one of the columns, I used this method https://www.knime.com/nodeguide/control-structures/loops/example-for-reading-a-list-of-files using that I could successfully read all the files which is amazing but I’m struggling to collect the names of the files as an extra column in the table from which the data is coming.

If I have 2 files named Table1 and Table2,
Table1:
Column1 Column2
a x
b y

Table2:
Column1 Column2
c p
d q

I want my resultant table to look like this
Resultant Table:
Column1 Column2 ColumnOfFileName
a x Table1
b y Table1
c p Table2
d q Table2

Any help?

Including a Variable to Table Column node inside your loop should solve the problem.

@toscanomatheus Thanks for the quick reply,

I’m very new to Knime and having difficulties in understanding Looping concepts so can you please tell me where should I use the Variable to Table Column node. An example workflow would be much appreciated.

Got it

1 Like

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