Write CSV Activity delimeter question

Hey everyone,

I have a DataTable which I want to write to CSV with “μ” as delimeter, but there are only 5 delimeter options which non of them is " μ " . How can solve this issue? I need to use μ as the delimeter.

Thank you,

@jntrk
Refer these links
Write/Read/Append CSV - delimitator
Write CSV delimiter does not work

These links are not really about making a custom delimeter.

There are tricks in the first link

  1. By vvaidyaVinay VaidyaMVP

  2. By ClaytonMMVP

Try those tricks, They might work.

@jntrk
Try these steps
1.Write the csv with pipe(|) delimeter.
2.read it as a text file with “read text file” activity.
3.replace the pipe(|) with “μ”.
4.write it again in “write text file” activity with .csv extension.

Thanks.
Tapan

Another option is to use Invoke Code with CvsHelper.CsvWriter (which is the same class Write CSV activity is using.)

Code:

Dim sw As StreamWriter = File.CreateText(in_FileName)
Dim csv As CsvWriter = New CsvWriter(sw, System.Globalization.CultureInfo.InvariantCulture)

csv.Configuration.Delimiter = "μ"

' Write headers
For Each col As DataColumn In in_DT.Columns
	csv.WriteField(col.ColumnName)
Next col
csv.NextRecord

' Write rows
For Each row As DataRow In in_DT.Rows
	For i As Integer = 0 To row.ItemArray.Count-1
		csv.WriteField(row(i).ToString)
	Next
	csv.NextRecord
Next row

sw.Close

' Clean up
sw.Dispose
csv.Dispose

thank you very much sorry for delayed response, is there anyway for me to write it to text file as well?

When i read the csv with read csv activity “µ” is read as �, so can I also write the datatable to text file properly?

You can’t use Read CSV activity since it doesn’t support a custom delimiter. The CSV file generated by the code is just a regular text file with a .csv extension instead of .txt. If you want to read that file, you can use the Read Text File activity and then convert it to a data table with Generate Data Table activity.

image

Generate Data Table Wizard:
image

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.