adaltas / adaltas/node-csv

How to get the column headers?

Open
#436 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
4.3k
Forks
299
Avg merge
16h 19m
Merged PRs (30d)
1

Description

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);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sync API invocation shown in the issue and inspect how the parse result is shaped when columns, info, and cast are enabled. Determine whether the first-line headers are exposed by the current API or require a documented change, then verify the expected result with the parser's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.