0

I have multiple CSV files, each with the same set of row/column titles but each with different values. For example:

CSV-1.csv
A,B,C,C,C,X
A,A,A,A,C,X

CSV-2.csv
A,C,C,C,C,X
A,C,A,A,C,X

and so on...

I have been able to figure out how to read the files and convert them into HTML pre-formatted tables. However, I have not been able to figure out how to paginate when there are multiple files with data (as shown above) such that I get only a single table at a time with "Next" and "Previous" buttons (to be able to effectively see the changes in the table and data.

Any ideas would be greatly appreciated.

1 Answer 1

1

If you know in advance what the files are, then predetermining the line count for each file would let you do the pageination.

Then it'd be a simple matter of scanning through this line count cache to figure out which file to start reading from, and just keep reading lines/files until you reach the per-page line limit.

Otherwise, you option will be to open/read each file upon each request, but only start outputting when you reach the file/line that matches the current "page" offset. For large files with many lines, this'd be a serious waste of cpu time and disk bandwidth.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.