I have an instance where I need to convert an arra...
# suitescript
a
I have an instance where I need to convert an array to a csv file. How do I convert the array into a comma separated string for creating the csv file?
s
papaparse
💯 2
a
let csvString = dataArray.join(',');
assuming you already split it into line data
a
How would I split it into line data?
b
depends on how good you need to make the csv
a
i don't know what your source data looks like?
b
actual csv requires you to escape characters
which typically requires you to use replace and join
it doable yourself, but https://www.papaparse.com/ will do it for you
💯 2
if you have to actually parse csv, then i would recommend skipping attempts to do it yourself
a
papaparse worked like magic. Thank you for the support.