Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Combine 2 csv files of different columns into 1 file

  1. #1
    Join Date
    Jul 2011
    Posts
    1

    Default Combine 2 csv files of different columns into 1 file

    Hi,

    I am new to Kettle Spoon and I would like to combine 2 csv files of different columns into 1 file. (Sorry if this is a noob question)

    For example, a mockup of the 2 files:
    file1.csv
    col1,col2,col3,col4
    f1val1,f1val2,f1val3,f1val4

    file2.csv
    col2,col4,col5,col6
    f2val2,f2val4,f2val5,f2val6

    I would like to combine into the following output
    col1,col2,col3,col4,col5,col6
    f1val1,f1val2,f1val3,f1val4,,
    ,f2val2,,f2val4,f2val5,f2val6

    Can anyone provide any guidance?

    Thanks!

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Add 2 empty constant values ("Add Constants" step) after reading the files (col5,col6 for one and col1,col3 for the other).
    Then use 2 "Select Values" step to re-arrange the fields in identical order.
    Then you can use any step to collect both sets of rows.

  3. #3
    Join Date
    Sep 2014
    Posts
    1

    Default

    Matt,
    Can you help with a sample kjb file

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Did you read the introductory books?
    Did you skim the workflows in your samples folder?
    Have you ever successfully tried to follow simple directions before?

    Try it now and if you get stuck, attach your workflow and talk about your design decisions.
    Someone will comment, then.
    The result should look similar to the one I attached.
    Good luck.

    Name:  UNION.png
Views: 328
Size:  18.4 KB

    Of course, there is a fat chance that the Kettle master mind will find your request challenging enough to drop his current projects, so you might just want to stay in bed and wait.
    So long, and thanks for all the fish.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.