This repository was archived by the owner on Jun 28, 2021. It is now read-only.
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Fields starting with equals (=
) do not open correctly in Excel #103
Open
Description
If a field value starts with equals character (=
), the csv does not open correctly in Excel. This may technically be an Excel problem, but it would be nice if there was some kind of "excelSafe" option to csv-stringify.
Examples:
Field CSV Encoding What Excel Shows Excel-safe CSV Encoding (causes Excel to show same as input)
=test =test #NAME? "=""=test"""
="test" "=""test""" test "=""=""""test"""""""
="test "=""test" ="test "=""=""""test"""
Workaround:
cast: {
string: s => s.charAt(0) === '=' ? `="${s.replace(/"/g,'""')}"` : s,
}