Just starting out with UI Path and was given this challenge from my manager. He wants me to open a file folder which contains a bunch of csv files. Grab the latest csv files, merge then together, then save as an excel spreadsheet.
I know I can download each file individually by using the Read CSV activity and giving it a file path and doing each file individually and then you can merge the all the csv files with the Merge activity and export as a data table and then convert it to an excel spreadsheet after the merge.
However, the number of files in the folder will continually update, so I need to grab the most current ones in the folder, then merge them and convert them into one excel sheet.
What I’ve been trying to do is grab all of the files using:
Directory.GetFiles("C:\Users\pKosten\Documents\UiPath\excelMerge\montly_reports/","*.csv")
Then use a For Each activity to loop through each of the files. This is where I get stuck though.
In the for each loop, do I create the data table first or read the csv file first, then output it as a data table? Or in the for each should I read each csv, then write and merge the csv and then convert it to an excel spreadsheet?
Any help on the direction I should use would be greatly appreciated.
Thanks in advance