I'm creating a .csv file with nodejs fw-extra
. I'd like to open this file using excel, however, I'm having problems where I have comma's in my string. I've been looking on stack overflow for a solution. The recommendation is to replace a,
with ""
. When I do this, the ""
appear in excel. It doesn't seem to recognise this pattern. What am I missing?
The string I'm trying to save is bob, 2
. In the example below I use the double quotes instead of a ,
as per the suggestions I've read.
const fs = require("fs-extra");
const name = 'bob"" 2';
async function loadUrl(page, url) {
await fs.writeFile(
"out.csv",
"name\n"
);
console.log(1);
await fs.appendFile(
"out.csv",
`${name}\n`
);
}
loadUrl();