Yes it is possible to do that in PHP and with CSV files. You basically iterate over the large file and chunk each X rows, forwarding those rows to another file.
You find the information how to open the large CSV file as an iterator in this answer here:
Then you need to chunk the iterator each X rows parts. That can be done as outline here:
Just instead of outputting into multiple <ul>...</ul>
HTML lists, you copy over into a new files. That basically works like outlined in:
However this time you want to use the SplFileObject::fputcsv
method. Take care you use the latest stable PHP for this, otherwise you need do different, see fputcsv()
.
If the first line of the original file contains column-headers, you might be as well interested in the following:
It just shows some ways to extend / process the incomming file. You might not need the full abstraction done there, just keeping the first line around might do it already.