Skip to content

XLSX reader - Exception : You must specify a worksheet or a scope for a Named Range #1686

@vpratfr

Description

@vpratfr

This is a bug report

What is the expected behavior?

Read a simple XLSX file (no formula inside) without exception

What is the current behavior?

The XLSX reader crashes with the message

PhpOffice\PhpSpreadsheet\Exception : You must specify a worksheet or a scope for a Named Range
 /home/vagrant/code/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php:21
 /home/vagrant/code/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/DefinedName.php:97
 /home/vagrant/code/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:1398

What are the steps to reproduce?

// This works properly, file is open
$reader = new Xls();
$reader->load(storage_path('default.xls'));

// This fails to open with the above exception
$reader = new Xlsx();
$reader->load(storage_path('default.xlsx'));

test.zip

The above zip file contains the XLS and XLSX files that exhibit the behaviour. The XLS file is simply the XLSX file saved as XLS (no change in the spreadsheet itself).

Which versions of PhpSpreadsheet and PHP are affected?

Package 1.15.0
PHP 7.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions