I'm parsing a CSV using Utilities.parseCsv() but some cells have the new line character and at the moment I parse the value, it creates three different records out of one. Is there a way to remove /n to have it as a one cell.
Sample CSV
Parsed CSV
| id | comment |
|---|---|
| 1 | one Line |
| New Line | |
| Third Line | |
| 2 | one Line |
| 3 | One line |
| Second Line |
Parsed Array
[
["id","comment"],
[1,"One Line"],
["","New Line"],
["", "Third Line"],
[2,"One Line"],
[3,"One Line"],
["","New Line"]
]
Note:
.replace() or .replaceAll() won't work on the parsed csv, because once it is parsed with Utilities.parseCsv() it creates a new array element.
Ideally it would work if the array element comes like this:
["1","One Line
Second Line"]
but instead it is parsed like this:
["1", "One line"],
["Second line",""]
