Turn a raw XLSX export into a useful sales report with FastExcelWriter: style headers and data, set number formats and column widths, freeze headers, add filters, and build a summary sheet.
Streaming export with cursor() keeps memory flat, but touching a model's relations inside the export triggers N+1 — thousands of extra queries. Here is why cursor() cannot help with relations and how to export them through lazy() without giving up the memory savings.
Does importing a large Excel file kill PHP on memory? Here is why the workbook object model is doomed to OOM, and how to read a million-row XLSX with flat memory use — on XMLReader and generators in FastExcelReader.
Dates turn into 44898, leading zeros vanish from SKUs, card numbers become 8.98E+18. Those are not bugs — that is how Excel stores values. Learn to type your data correctly when exporting to XLSX with FastExcelWriter.
Word has mail merge: you take a template with fields and drop the data in. Excel appears to have nothing of the sort out of the box — so developers start assembling documents cell by cell in code. In fact, substituting values into a ready XLSX takes two lines: placeholders, the fill/replace difference, and the usual traps.
Importing Excel into Eloquent models usually turns into a loop that picks cells apart by hand. Here is how withHeadings() and mapping() cut it down to a few lines, and how to bind “foreign” columns of a file to your model's attributes without guesswork.
Does your Excel export die with an out-of-memory error on large data? The cause is the “whole workbook in memory” object model. Here is how to write a million rows to XLSX with flat memory use in plain PHP: FastExcelWriter's row → temp file → ZIP streaming scheme.
The accountant has already drawn the invoice form in Excel — with a logo, borders, number formats, and formulas. There is no need to reproduce that in code: FastExcelTemplator takes the ready XLSX as a template, substitutes data for the placeholders, and repeats table rows while keeping the formatting.
Laravel Excel runs out of memory on a large export not because of your code but because of PhpSpreadsheet's architecture. Here is why chunking does not save you, and how streaming export through cursor() keeps memory flat.
You need Excel in PHP, and the very first search result is PhpSpreadsheet — universal, heavy, and not always the right fit. Let's sort out what kinds of Excel tasks actually exist (reading, writing, templates) and how to tell which one is yours, so you don't haul in a combine harvester where a screwdriver would do.