Merge multiple CSVs into one and add the file name as column

I can merge CSVs now but my question is how do i add the source file name as a column on the consolidated file?

Hi @kelvinC , and welcome to the KNIME community.

You just have to activate ‘Append path column’ in the Advanced Settings tab of the ‘CSV Reader’ node
image

BR

4 Likes

Thanks! I still have another question but is unrelated to this so i dont know if that is allowed but here it is.

my data looks like this. it has

Type	Transaction	ID	Amount
Car			
	A	AB	1000
	B	BC	2000
	C	CD	5000
Truck			
	X	XX	1000
	Y	YZ	2000
	Z	ZZ	5000
Person			
	G	XX	1000
	H	YZ	2000
	I	ZZ	5000

and i want it to look like this.

Type	Transaction	ID	Amount
Car	A	AB	1000
Car	B	BC	2000
Car	C	CD	5000
Truck	X	XX	1000
Truck	Y	YZ	2000
Truck	Z	ZZ	5000
Person	G	XX	1000
Person	H	YZ	2000
Person	I	ZZ	5000

It has blanks on the first column/type and i want it to populate based on whats on previous row.

Thanks again!

Hi @kelvinC

Your workflow should be like this… with the following configurations
image

  1. Rule Engine -
    MISSING $Transaction ID$ => $TYPE$
    Append Column: ‘CLASS’

  2. Missing Value - Column Settings >> CLASS :: Previous Value *

  3. Rule-based Row Filter
    MISSING $Transaction ID$ => TRUE
    Exclude TRUE matches

BR

PS.- as it is already marked as solution. You should open a new post for the different subjects (next time)

2 Likes

thanks! will do! still a noob so please accept my apologies :smiley:

2 Likes

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