Remove the Double qoutes which is coming in Datatable

Hi Everyone,


I have extracted some data from the email body and I wanted to enter the same in a data table so that I can convert the data table into CSV.
in one of the column I am getting the double qoutes “”, when I am placing the variable in data table, but prior to that when I check the variable in writeline activity it doesn’t have any sort of double braces but when I am writing the same variable in a datatable using add data column , rest all variable in datatable is fine but only one variable is having braces as shown in screenshot.

Please let me know how to remove the double qoutes from the data table ?

Thank You

@Binod_Kumar_Biswal

Try this

row(“YourColumnName”) = row(“YourColumnName”).ToString().Replace(“{{”, “”).Replace(“}}”, “”)

OR

For Each Row (in DataTable)
Assign
To: row(“YourColumnName”)
Value: row(“YourColumnName”).ToString().Replace(“{{”, “”).Replace(“}}”, “”)

Hi,

If possible, can you share your workflow?

Regards,

@Binod_Kumar_Biswal

1)To remove double braces from a string variable when adding it to a DataTable

try this:

input_DataTable.Rows.Add(input_variable_string.Replace("{{", "{").Replace("}}", "}"))

cheers…!

Hi Yoichi,
Sorry I can’t share the workflow since the laptop is hardened.

If you want any sort of other input I can provide you the same.

Thanks

Hi @Dilli_Reddy ,

Tried the approach but still getting the same double qoutes which I was getting earlier as shown in screenshot.

Hi,

Can you share how you output the string? Did you use OutputDataTable activity?
If so, it autoamtically suroonund data by double quote if it contains comma or linebreak etc.

If you need CSV at the end, can you try to use WriteCSV without tab delimiter and ShouldQuote?

image

Or we can also use WriteRange to output it to xlsx file.

Regards,

Hi @Yoichi ,

Yes for output string I was using outputDT activity.

At the end I want CSV, I followed what you suggested I unchecked the ShouldQuote, now quote is not there but still there is a extra line that is coming (as shown in screenshot), can you please suggest how to remove the linespace so that all the values come in same line ?

Can you try this way

For each row inside take one assign activity and pass this regex expression

System.Text.RegularExpressions.Regex.Replace(CurrentRow(0).ToString,"[""]","")

@Binod_Kumar_Biswal

Hi,

Can you try to remove linebreak at the target column in the datatable as the following?

image

 CurrentRow(1)=CurrentRow(1).ToString.Replace(vbcr,"").Replace(vblf,"")

Then write it to CSV file using WriteCSV

Regards,

1 Like

Try this expression; it will produce a single line of text and eliminate the double quotes and line.

System.Text.RegularExpressions.Regex.Replace(CurrentRow(0).ToString,"[""\r?\n]","")

output: -

@Binod_Kumar_Biswal

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