I have many data files that I need to consolidate into a single file. The source data files are simple csv text files with a single column. I need to take maybe a few hundred of these csv files and copy each of their column data over to a single excel file. So it would be something like this:
Point to a directory that contains the csv files. For all csv files in that directory, copy their single column data into a single excel file.
So if I had CSV files A, B, C, D, E, the resulting excel file would have 5 columns in it.
I know basic macros to handle where I want data to go from on file to another, but what I could use some assistance on is all the file handling in the first place.
Think I would have to be able to specify the source directory, get a count/list of all the csv files and then loop through the filename list. Inside the loop would be the copying of the column data.
So basically my hurdle here is the handling of all the files with a macro. Once I can do that, the transfer of data in the loop should be straightforward. Thanks for any ideas.
I can write a macro to transfer data from one csv to the excel file one at a time but I have to do this a couple of hundred times. Just need to figure out how to loop through all the files.
ActiveSheet.QueryTables.Add("TEXT;" & xFileName, Range(xAddress))