Jonas
Jonas

Reputation: 1

Pentaho Spoon Data Integration, Merge two csv

I want to merge two csv files. The first looks like that: url;name;api. url fields contain 50 times the same url, name is empty and api fields contain 50 times the same api key. The second csv looks like that: url;name;api. url is empty, name contains 50 different names, api is empty.

I want to create one csv file: url;name;api with the information from both csv, so url and api contains the value from the first and name from the second csv.

so far i just create two csv input and hooked them with one csv output. The resulting csv has 100 records, 50 with null as name and 50 with null in url and api.

. enter image description here

enter image description here

enter image description here

Upvotes: 0

Views: 1255

Answers (1)

AlainD
AlainD

Reputation: 6356

If you want to increase the number of columns, you need a Lookup or a Join.

You have a main stream and for each row of the stream, you fetch one row (Lookup) or many rows (Join) in the secondary stream.

In your case, I would first remove all the unnecessary field (the name in the first csv file, and the url and api in the second), and unnecessary rows (keep only one row in the first csv file). Then drop both flows in a Join Rows steps.

And, if I do understand your use case, you did probably over complicated the case, because to direct the flow in the same step (here the Text output 2) needs the columns to be the same, so that they can add the rows of the input one after the other.

Upvotes: 2

Related Questions