Collating CSV files to form a main CSV File

I was just wondering from a specified directory file path in how to collate all files that are formatted as csv and add them to one main CSV file. So far I Am using build data table in a sequence which drops to ForEach file in Get_Files_From_Folder (A string array using the expression directory.GetFiles)

How do I add each row and then saving each row as a separate File.

Hi @Stabbathehut

just use Merge Datatable Activity for consolidate the data into one file.

Cheers :slight_smile:
Happy Learning

Regards
Achal Sharma

2 Likes

As I am just starting off, could you use it as an example please

hi @Stabbathehut

Please refer this example for the consolidation of the data into one file.

Main.xaml (8.5 KB)

Cheers :slight_smile:
Happy Learning

Regards
Achal Sharma

2 Likes

Main.xaml (17.2 KB)

I am getting some exception error, where I try to check whether the data has been placed into the consolidated CSV. The error below is the general problem.

RemoteException wrapping System.NullReferenceException: Object reference not set to an instance of an object.
at UiPath.CSV.Activities.WriteCsvFile.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)