csv-writer icon indicating copy to clipboard operation
csv-writer copied to clipboard

Add Extra Line After Writting the Headers

Open faizan2077 opened this issue 11 months ago • 0 comments

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; }`

faizan2077 avatar Mar 12 '25 04:03 faizan2077