Hi all,
I have a requirement to create a "superset" file out of a number of different sources with some different and some same columns.
We intend to have a manually updateable SuperSetCols.csv which would look like
"ColA","ColB","ColC","ColD","ColE","ColF","ColG"
so someday we may add ColH ColI etc We will only ever add to the end of the list as new columns are required.
Our sources look like this:
File0.csv
"ColA","ColB","ColC"
"Dat001","Dat002","Dat003"
"Dat011","Dat012","Dat013"
File1.csv
"ColA","ColB","ColD"
"Dat101","Dat102","Dat104"
"Dat111","Dat112","Dat114"
File2.csv
"ColD","ColE","ColF","ColG"
"Dat204","Dat205","Dat206","Dat207"
"Dat214","Dat215","Dat216","Dat217"
Our intention is to basically fill the gaps where necessary. So File0 needs columns D-G, File1 C & E-G and File2 A-C. The column names are expected to match identically and again remain in order as per the superset.
We would like to output the files to a 'Super' directory as follows:
Super/File0.csv
"ColA","ColB","ColC","ColD","ColE","ColF","ColG"
"Dat001","Dat002","Dat003","","","",""
"Dat011","Dat012","Dat013","","","",""
Super/File1.csv
"ColA","ColB","ColC","ColD","ColE","ColF","ColG"
"Dat101","Dat102","","Dat104","","",""
"Dat111","Dat112","","Dat114","","",""
Super/File2.csv
"ColA","ColB","ColC","ColD","ColE","ColF","ColG"
"","","","Dat204","Dat205","Dat206","Dat207"
"","","","Dat214","Dat215","Dat216","Dat217"
So that a different process will be able to concatenate them when it is ready and read them as one common file structure:
"ColA","ColB","ColC","ColD","ColE","ColF","ColG"
"Dat001","Dat002","Dat003","","","",""
"Dat011","Dat012","Dat013","","","",""
"Dat101","Dat102","","Dat104","","",""
"Dat111","Dat112","","Dat114","","",""
"","","","Dat204","Dat205","Dat206","Dat207"
"","","","Dat214","Dat215","Dat216","Dat217"
Many thanks in advance to all who reply, I would greatly appreciate anyone's help on this!
Lee