PHP Generators support #3026
Replies: 2 comments
-
It's not really clear what you expect here: Generators aren't a magic wand that can fix any problem. PhpSpreadsheet works by providing an "in-memory" representation of a spreadsheet, loading the data from the spreadsheet file into memory. Most spreadsheet file formats don't use a structure that is condusive to reading/writing in a linear manner; with the exceptions of csv, they are not simple streams of data. I'm guessing that you're reaching memory limits; and I'd suggest that you read a bit about the PhpSpreadsheet architecture, and about some of the options that are available to reduce memory usage when working with the library. Despite the fact that you say there is no clarification in the documentation, there are several places where this is explained; and we provide a number of options for reducing that memory footprint. So we provide a caching mechanism that reduces the memory footprint required to maintain a lot of cell data, allowing you to maintain the data in a cache while PhpSpreadsheet maintains a much smaller mapping between cells and cache. We provide various filtering options allowing you to limit the data that you read from a spreadsheet file. You give no indication of where your problem is, whether you're reading files; or whether you're creating a spreadsheet object to generate a file; or some combination of both. If you only ever read of write csv files that do have a linear structure, and have no additional spreadsheet features, then I suggest that you don't use PhpSpreadsheet; but use PHP's native csv functions (that can be managed as a stream, and wrapped with Generators for both reading and for writing). Additional memory problems are often created by developers loading a spreadsheet, and then using methods like |
Beta Was this translation helpful? Give feedback.
-
Thank you @MarkBaker |
Beta Was this translation helpful? Give feedback.
-
This is:
What is the expected behavior?
What is the current behavior?
Beta Was this translation helpful? Give feedback.
All reactions