Skip to content

Add Extra Line After Writting the Headers #116

@faizan2077

Description

@faizan2077

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions