Download Latest Version v5.18.0 source code.zip (33.6 kB) Google Add to Preferred Sources
Home / v5.18.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-10-29 1.3 kB
v5.18.0 source code.tar.gz 2026-10-29 27.0 kB
v5.18.0 source code.zip 2026-10-29 33.6 kB
Totals: 3 Items   62.0 kB 0

autoSizeColumns()

Columns used to export at Excel's default width unless you set every width by hand. autoSizeColumns() sizes each column to fit its widest value:

:::php
(new FastExcel($list))->autoSizeColumns()->export('file.xlsx');

Widths are measured while rows stream past and written just before the file is finalized, so it works with generators and cursors without buffering rows. Each sheet of a SheetCollection is sized on its own, and widths are clamped to configurable min/max bounds. It's an estimate (character count adjusted for bold and font size), not Excel's AutoFit. It is xlsx only.

Implemented by @elminson in [#422]. Fixes [#213], reported by @hemasharshar. Thanks to @dannyyol, whose design notes on the issue shaped the opt-in, heuristic approach and its docs.

Fixes

  • Export callback returning null/false now skips the row instead of crashing on Collection/array input or writing a blank row on generator input. The caller's source collection is no longer mutated in place. Fixes [#423] (#424), by @moemadeldin.
  • limitRows() now applies to exports; before, it was silently ignored. It limits rows per sheet on multi-sheet exports. Fixes [#425] (#426), by @moemadeldin.

Full changelog: https://github.com/rap2hpoutre/fast-excel/compare/v5.17.0...v5.18.0

Source: README.md, updated 2026-10-29