1. Refrain when working with Excel data in the form of objects - pass simple arrays. This will greatly reduce the memory, especially if you are using AR.
2. Use queues and console application. A console application has no limits on memory and duration.
winnifred_Ondricka answered on April 3rd 20 at 18:27
xlsx is just a zip archive with a bunch of things complicated. That the file is 1MB - it literally means nothing. To parse this file into components need quite a lot of memory. In nutriance yuzaetsya PHPOffice/PhpSpreadsheet , each cell of your document is an object, that count))
If you direct all critical memory - can take a serious look at converting xlsx -> csv (here processes everything you need) ->. xlsx
darrel.Medhurst answered on April 3rd 20 at 18:29
Read Excel I recommend to use the package (in composer "phpoffice/phpspreadsheet")
It pieces (e.g., 500 rows) to read the file, then memory issues will not.