csv-writer
csv-writer copied to clipboard
Add Extra Line After Writting the Headers
When I write the row of header in CSV file it add extra row after the headers:
here is my function:
`export async function writeCsvHeaderWithCsvWriter(filename, columns) { const filePath = getPath(filename); const csvWriterFile = createObjectCsvWriter({ path: filePath, append: true, header: _.map([...columns], (col) => ({ id: col, title: col })), alwaysQuote: true, });
const headerRow = {}; _.forEach([...columns], (col) => _.extend(headerRow, { [col]: col })); await csvWriterFile.writeRecords([headerRow]); return csvWriterFile; }`