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.
We had barely finished the post about 4.0 when 4.1 and 4.2 shipped. Here is what changed: Excel::open() now detects the format from the file signature and reads XLSX, XLS, and CSV in a single line — no more branching on the file extension.
PhpSpreadsheet burns hundreds of megabytes even on small files and dies outright on large ones. If your job is to read data out of Excel rather than edit a workbook, there is a sharper tool: FastExcelReader streams XLSX and CSV — fast and with almost flat memory — without losing dates, styles, merged cells or images. An overview of the reader.