Skip to content

Output not compatible with spreadsheet CSV importers #8

@wxdu

Description

@wxdu

Hi Matteo,

I haven't looked at Excel, but for OpenOffice, at least, it expects double-quotes to be doubled, rather than backslash-escaped, even when the string delimiter is a double quote already. This seems insane to me, but the spreadsheet people claim it's their standard.

Since you're using JSON.stringify, you're outputting backslashed double-quotes.

In order to use your (very useful) package in my project, I added a line to your convertToCsv function, at the end of the string replace chain: .replace(/\"/g, '""');

This is working well for me. I'm not sure if it's something you would want to do by default, since I'm not sure that everyone who uses your package is trying to import into a spreadsheet.

But I thought I would mention it.

Cheers,

Ross Grady

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions