<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Best way to export collection to CSV in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123790#M54154</link>
    <description>&lt;P&gt;here is the code which will export collection to CSV and this code will handle all double quotes, single quotes and commas between names&lt;/P&gt;&lt;P&gt;this code stage takes 2 input parameters (csv full file path and collection) and 2 output parameters (Success and error message)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim dt As DataTable = InCollection 
Dim filePath As String = csvFilePath

Try
	Success = True
	ErrorMessage = ""

	Using sw As New StreamWriter(filePath, False, System.Text.Encoding.UTF8)
		
		'Write headers
		Dim columnNames As String = String.Join(",", dt.Columns.Cast(Of DataColumn)().Select(Function(column) """" &amp;amp; column.ColumnName.Replace("""", """""") &amp;amp; """"))
		sw.WriteLine(columnNames)
 
		'Write rows
		For Each row As DataRow In dt.Rows

			Dim fields As New List(Of String)()
			For Each column As DataColumn In dt.Columns
				Dim value As String = row(column).ToString()
				'Escape double-quotes in values, always use double quotes around value
				value = value.Replace("""", """""")
				fields.Add("""" &amp;amp; value &amp;amp; """")
			Next
			sw.WriteLine(String.Join(",", fields))
		Next
	End Using

Catch Ex as Exception
	Success = False
	ErrorMessage = Ex.ToString()

End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="naveed_raza_0-1764873786341.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/41755i7AD427A913A328E6/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="naveed_raza_0-1764873786341.png" alt="naveed_raza_0-1764873786341.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="naveed_raza_1-1764873814023.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/41756i172554B6B9ABD4ED/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="naveed_raza_1-1764873814023.png" alt="naveed_raza_1-1764873814023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Dec 2025 18:45:15 GMT</pubDate>
    <dc:creator>naveed_raza</dc:creator>
    <dc:date>2025-12-04T18:45:15Z</dc:date>
    <item>
      <title>Best way to export collection to CSV</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123764#M54146</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;What is the best to way to export collection to CSV in proper UTF-8 unicode compatibility.?&lt;/P&gt;&lt;P&gt;it should handle all double quotes , single quotes and commas between names and should be very reliable to handle thousands and lacks of records&amp;nbsp;&lt;/P&gt;&lt;P&gt;any suggestions and what are all multiple ways to do that ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 12:37:02 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123764#M54146</guid>
      <dc:creator>naveed_raza</dc:creator>
      <dc:date>2025-12-03T12:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to export collection to CSV</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123765#M54147</link>
      <description>&lt;P&gt;Initially , i have exported data to Excel using MS Excel VBO and MS Excel VBO Extended object and saved the file as CSV using Workbook Save As. Its was saving the file in CSV format however it was not UTF-8 compatibility and when ever we open the file we are getting the pop up error.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 12:45:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123765#M54147</guid>
      <dc:creator>naveed_raza</dc:creator>
      <dc:date>2025-12-03T12:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to export collection to CSV</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123790#M54154</link>
      <description>&lt;P&gt;here is the code which will export collection to CSV and this code will handle all double quotes, single quotes and commas between names&lt;/P&gt;&lt;P&gt;this code stage takes 2 input parameters (csv full file path and collection) and 2 output parameters (Success and error message)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim dt As DataTable = InCollection 
Dim filePath As String = csvFilePath

Try
	Success = True
	ErrorMessage = ""

	Using sw As New StreamWriter(filePath, False, System.Text.Encoding.UTF8)
		
		'Write headers
		Dim columnNames As String = String.Join(",", dt.Columns.Cast(Of DataColumn)().Select(Function(column) """" &amp;amp; column.ColumnName.Replace("""", """""") &amp;amp; """"))
		sw.WriteLine(columnNames)
 
		'Write rows
		For Each row As DataRow In dt.Rows

			Dim fields As New List(Of String)()
			For Each column As DataColumn In dt.Columns
				Dim value As String = row(column).ToString()
				'Escape double-quotes in values, always use double quotes around value
				value = value.Replace("""", """""")
				fields.Add("""" &amp;amp; value &amp;amp; """")
			Next
			sw.WriteLine(String.Join(",", fields))
		Next
	End Using

Catch Ex as Exception
	Success = False
	ErrorMessage = Ex.ToString()

End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="naveed_raza_0-1764873786341.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/41755i7AD427A913A328E6/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="naveed_raza_0-1764873786341.png" alt="naveed_raza_0-1764873786341.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="naveed_raza_1-1764873814023.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/41756i172554B6B9ABD4ED/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="naveed_raza_1-1764873814023.png" alt="naveed_raza_1-1764873814023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 18:45:15 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123790#M54154</guid>
      <dc:creator>naveed_raza</dc:creator>
      <dc:date>2025-12-04T18:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to export collection to CSV</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123997#M54219</link>
      <description>&lt;P&gt;Found another way of exporting collection to CSV , using inbuilt business object&lt;/P&gt;&lt;P&gt;Utility - Collection Manipulation V10 - has action &lt;STRONG&gt;Save Collection to CSV File,&amp;nbsp;&lt;/STRONG&gt;which saves writing custom code&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="naveed_raza_0-1765653213980.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/41819iB8AA1AF82D1732D4/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="naveed_raza_0-1765653213980.png" alt="naveed_raza_0-1765653213980.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Dec 2025 19:14:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Best-way-to-export-collection-to-CSV/m-p/123997#M54219</guid>
      <dc:creator>naveed_raza</dc:creator>
      <dc:date>2025-12-13T19:14:00Z</dc:date>
    </item>
  </channel>
</rss>

