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

Pass line number to Interpreter? #29

Open
Richtermeister opened this issue Feb 6, 2014 · 5 comments
Open

Pass line number to Interpreter? #29

Richtermeister opened this issue Feb 6, 2014 · 5 comments

Comments

@Richtermeister
Copy link
Contributor

Currently the interpreter is unaware of which line number it is given. This information would be useful to log row-level issues or report on progress. Of course this can easily be implemented in a custom Interpreter, but it might be useful enough to make it part of the library.

If there is interest in this feature, I would be happy to implement it.

@BillyTom
Copy link

I am also looking for this feature. I would like to handle the first and last line of the import differently.

@Richtermeister
Copy link
Contributor Author

@BillyTom I actually changed my approach a little.. I just use a custom Interpreter which keeps track of the row number. You only have to remember to reset that number when you import multiple files. With regards to the last row, I am not sure how you would know which row is the last, as this lib reads only one row at a time.

@qury
Copy link

qury commented Sep 13, 2014

Hi,
Is there a way to only get the 1st line of a file with this library?
I ,m dealing with multiple files with different column count. and I'm using the first line as column headers/field names in a database..

@garygreen
Copy link

@suin any news on this? I'm also looking for a way to determine what is the last line. Our use case is we basically loop through the csv and every 100 rows we flush data to the database in one INSERT. When it's on the last line, it should always flush in case there was only e.g. 99 items on the last group.

@jared-fraser
Copy link
Contributor

@garygreen this repo hasn't had a commit in a year. i'd move on to another CSV parser that is actively maintained.

https://github.com/thephpleague/csv is the one i now use.

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

No branches or pull requests

5 participants