Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore comment lines for the from_line value #422

Open
andrews05 opened this issue Mar 14, 2024 · 0 comments
Open

Ignore comment lines for the from_line value #422

andrews05 opened this issue Mar 14, 2024 · 0 comments

Comments

@andrews05
Copy link

andrews05 commented Mar 14, 2024

Summary

I would like it if the from_line option could ignore comment lines when determining the line number.

Motivation

I receive a CSV structured like this:

// Some
// Number of
// Comments
thing1=value1
thing2=value2
header1,header2,header3
value,value,value
...

Where there's some arbitrary number of comment lines at the top, followed by exactly 2 lines of unrelated data that I need to skip before the actual csv content begins. The exact starting line can vary.

Alternative

I'm fetching the csv using got.stream and piping it into parse, then processing rows using for await. I might be able to add some middleware to filter out the unwanted rows before it goes to the parser but I'm not sure the best way to approach that.

Draft

Ideally I would like to be able to use {comment: '//', from_line: 3} to skip over all comments as well as the 2 unrelated lines. I.e. it would start parsing from 3rd non-comment line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant