Hi All, How to handle comma in the string when cre...
# suitescript
s
Hi All, How to handle comma in the string when creating a CSV file. I have an address field in my data, which is placed in another cell. Thanks
m
You'll probably need to be using quotes or double quotes to separate your column data.
s
I tried like searchResult.replace(/,/g, '","') +','; searchResult.replace(/,/g, '\,') +','; do I need any modifications
b
csv has an escape mechanism
double quote (") the csv column value
there is also an escape character on the chance your csv column value contains a double quote
use two double quote ("") to represent a double quote (") in your escaped column values
if this sounds too hard, use papaparse
s
Thankyou @battk @Martin Horacek