Merge csv files with different and same headers

Well well. I set up a workflow that hopefully does what you want. The CSV data really seems to be quite messy with funny column headers and stuff. For the “resultatspreliminaires (15).csv” I had to revert to my trusted readr package from R. I really would recommend investing in some useful data storage concepts - CSV is widespread but also unstable and messy. Why not use Parquet, or SQLite, or ARFF - all supported by KNIME - but that is just me :slight_smile:

The workflow assumes the first 6 columns are always the same and gives them the names Column1 - 6 (you can later rename them to something useful).

Then I use readr to just import the data and determine the column headers and where the real data starts when the first line of Column1 does not have any missing (you might have to tweak that, give a fix number or delete some rows with missing data).

Then I load the data starting from the recently identified 1st row. Then the column names get assigned back.

hmm might be again a little bit over-engineered but I hope it works. Feel free to adapt it.

kn_example_read_multiple_resultatspreliminaires.knar (276.0 KB)

2 Likes