I have a text file with profanity word separated by comma (,). Now I have to create an array by reading this text file, each and every profanity word should be stored into t
Are you able to manipulate the CSV file manually before reading it? I had a similar issue, but was able to get the person that generated it to do a few things to it such as doing a global search/replace for '
→ \'
then wrapping the contents in a JS string variable. Then I just included the new file as I would any other JS file.
Ex.
Original CSV:
word,"multiple words",apostrophe's
Modified JS CSV:
var csvData = 'word,"multiple words",apostrophe\'s';
And then I used the Ben Nadel link posted by samccone to do the actual parsing.