July 22, 2024


Welcome to the core

Blue Prism – Collection to CSV – Custom Delimiter

This will show you how to take a collection and save as a CSV with custom delimiter.


New business object with a code language of C#
Code options to be used for this to work.

There needs to be the following inputs –

Collection – Collection
Delimiter – Text
Target – Text

In the code section if you use the following C#

StringBuilder sb = new StringBuilder();

string[] columnNames = Collection.Columns.Cast<DataColumn>().
Select(column => column.ColumnName).
sb.AppendLine(string.Join(Delimiter, columnNames));

foreach (DataRow row in Collection.Rows)
string[] fields = row.ItemArray.Select(field => field.ToString()).
sb.AppendLine(string.Join(Delimiter, fields));

File.WriteAllText(Target, sb.ToString());


If you have your data items set correct along with the collection it may look something like this.

In this example it will save the collection in C:\RPA\file.txt


Copyright © All rights reserved. | Newsphere by AF themes.