Skip to content

v4.2.0

Choose a tag to compare

@aVadim483 aVadim483 released this 26 Jul 12:26
· 9 commits to main since this release

Added

  • Reading CSV through Excel::open() — returns a one-sheet Csv\CsvBook exposing the same reading API as XLSX/XLS (key modes, read areas, withHeader(), readColumns(), ...). Format is chosen by signature (OLE2 → XLS, ZIP → XLSX, otherwise CSV); pass Excel::open($file, $options) to configure the CSV reader or ['format' => 'csv'] to force it. openCsv() is unchanged and still returns the low-level Csv\CsvReader (also via CsvBook::getReader()). CSV has no styles/dates/merged cells/images — those accessors return empty results. See docs/20-csv.md.
  • Excel::isXlsx() — ZIP-signature check (PK\x03\x04).
  • CSV binary guard — binary input (a NUL byte, or a high share of control characters) is rejected up front with a clear "file appears to be binary" error; UTF-16/UTF-32 text is exempt. New allow_binary option (CsvOptions::setAllowBinary()) turns it off.

Changed

  • Excel::open(string $file, $options = []) takes an optional second argument (BC-safe); a file that is neither OLE2 nor ZIP is now read as CSV instead of being pushed into the XLSX reader.
  • A ZIP that is not an XLSX (a DOCX/PPTX or a plain archive) now fails with "Not an XLSX workbook: the ZIP archive has no xl/workbook.xml" (with a DOCX/PPTX hint) instead of a cryptic "Internal file not found".

Fixed

  • CSV: an empty file (or one whose length is a multiple of the read buffer) no longer emits a PHP warning and a phantom trailing row.
  • CSV: CsvReader::rewind() now fully resets the read state, so re-reading after a partial pass no longer replays a stale buffer.

Full bilingual changelog: CHANGELOG.md · CHANGELOG.ru.md