add columns from 1 .csv to another .csv file using progress to automate this

xscottehx

Member
I get sent a folder containing many .csv files on a daily basis to keep the information up-to-date. I have 2 seperate .csv files that need to be used for a single report for example i need all columns from the first csv AND column 6 from the seconds csv. is there any way on a daily basis i can write a procedure to stitch 2 together so that i only need a single file. This will save me manually copying information from one to another everyday.

I am sure this is possible i just dont know how to go about it.

Thanks.
 
The easiest way is to have a temp table containing fields relating to all of the columns in the main spreadsheet and the column required from the second.
you then read from the main file and create a temp table record for each row of the spreadsheet.
You then close the file and read from the second file storing the column values in variables, you then find the temp table record that was created from the first spreadsheet and populate the field corresponding to the column from the second.

If you need this in csv format then do a for each on the temp table and export all of the fields, you now have a spreadsheet with all necessary columns.
 
Back
Top