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

How to get the column headers?

Open Thomas-1985 opened this issue 1 year ago • 3 comments

Describe the bug

Version: 5.5.3

I am using the sync api to parse a csv file and get the records. I also need the headers (on the first line) for later analysis but they are not present in the records (maybe thats intentional). How do i get these?

To Reproduce

I am using the following code for parsing

const data = file.data;
    const parseResult = parse(data, {
      cast: true,
      columns: true,
      skip_empty_lines: true,
      trim: true,
      info: true,
      delimiter
    } as Options);

Thomas-1985 avatar Aug 11 '24 09:08 Thomas-1985