-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add streaming mode for writing excel files #244
Comments
Do you mean create a spreadsheet from scratch, in-memory, and while you add new cells/rows, some "previous cells" are written down on disk and deleted from memory ? Keeping the memory usage very low at all time ? |
I was thinking that you could open a file pointer to php://output right away so the contents will start being served immediately.
For very large datasets php will run out of memory if it's kept in buffer all the time |
This would most likely be a huge undertaking and Mark's input might be needed. Would you be willing to work on that? |
I would absolutely be willing to help but I think it would have to be coordinated with multiple people. I have no real experience with working with the xlxs implementation details. What do you think? If it's a huge implementation change I wonder if it's really worth it, depending on how many library users would think this is useful. Especially since the mode would limit other aspects of the api |
I agree that having multiple person involved might be best. Unfortunately I won't have enough time for that myself. So if you can find others, or invest enough time by yourself, then go for it. Otherwise I guess we'll have to do without that feature. @MarkBaker any opinion on the matter ? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I could really use this right about now :/ |
I too my bro... 💃 |
me too |
same :( |
:( |
Up! |
To clarify, this is very unlikely to ever happen in PhpSpreadsheet. Spreadsheet content is not linear content, all kind of things depends on all kind of other things that must all exist at the same time to be able to write a complete, correct XLSX file. If you want to stream-write an XLSX file, you would lose really a lot of features. The API would need to be severely limited. So much so that it would not be reasonable to have a single codebase to support both use-cases. If you need this kind of thing, you better look for an alternative product. Maybe something like https://github.com/mk-j/PHP_XLSXWriter But if performance is your utmost concern, then https://www.php.net/manual/en/function.fputcsv.php is your best friend. |
Currently PhpSpreadsheet buffers the xlsx until it's written out to a stream which will be a problem if the generated dataset is very large.
Apache POI has a streaming implementation (https://poi.apache.org/spreadsheet/) where it solves this by restricting the operations if using it in a streaming mode.
Would it be possible to add something similar to PHPSpreadsheet?
The text was updated successfully, but these errors were encountered: