Closed rmitra-chub closed 1 year ago
The correct escaping of "
is ""
. It doesn't use the JS \
character.
For example:
Excel generates the following CSV:
noquote,"""startquote","mid""quote","endquote"""
If you save that to a file and try to open in Excel, it will have the correct data.
There's a possible bug in the
utils.sheet_to_csv
function (https://docs.sheetjs.com/docs/api/utilities#delimiter-separated-output) Function arguments:{ A1: { v: "sample header 1", t: "s", w: "sample header 1", }, B1: { v: "sample header 2", t: "s", w: "sample header 2", }, A2: { v: "\"sample text 1", t: "s", w: "\"sample text 1", }, B2: { v: "sample text 2", t: "s", w: "sample text 2", }, "!ref": "A1:B2", }
{ FS: '\t' }
Output: "sample header 1\tsample header 2\n\"\"\"sample text 1\"\tsample text 2\n" Expected Output: "sample header 1\tsample header 2\n\"sample text 1\tsample text 2\n"
The output is duplicating the double quote if there is one inside one of the values (in this example, A2).