When I try to open csv file using `N/file` even th...
# suitescript
b
When I try to open csv file using
N/file
even the string is inside quote mark, the columns are not showing properly.
Copy code
iterator.each(function (line) {
                    
                    // Update the total based on the line value
                    let lineValues = line.value.split(',');         
})
If csv is
5, "Hello, Brother", 10
then that lineValues has 4 columns (5, "Hello, Brother", 10). How could I fix this? Anyhelp would be appreciated.
e
I typically use
papaparse.js
for parsing CSV: https://www.papaparse.com/
💯 3
s
Was about to mention papaparse. Basically, there’s issues with quoting and escaping that are best left to a library that handles all of the edge cases for you and is tested. Unless you control the code generating the CSV file, it’s best to use a real library.
this 1
b
Thank you