Skip to content

Undefined index $ : while importing excel file #687

@sidrafarooq

Description

@sidrafarooq

This is:

-  a bug report

What is the expected behavior?

Trying to import an excel file (.xlsx) and file should be imported without any error

What is the current behavior?

During import i am getting undefined index $ error (IOFactory::load method is throwing this error) when i searched it, its because of autoFilter being applied.

2018-09-26 07:05:22 : #0 /var/www/html/project/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php(291): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined index...', '/var/www/html/s...', 291, Array)
#1 /var/www/html/project/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php(207): PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString('$A')
#2 /var/www/html/project/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php(111): PhpOffice\PhpSpreadsheet\Cell\Coordinate::rangeBoundaries('$A$1:$K$1')
#3 /var/www/html/project/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(1076): PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter->setRange('$A$1:$K$1')
#4 /var/www/html/project/app/Excel/FileLoader.php(286): PhpOffice\PhpSpreadsheet\Reader\Xlsx->load('/var/www/html/s...')

What are the steps to reproduce?

just upload an excel file downloaded through phpspreadsheet all filters applied (autoFilter are like this $A$1:$K$1 the dollar sign is creating problem when used in Coordinate.php line 291)

<?php

require __DIR__ . '/vendor/autoload.php';

$reader = IOFactory::createReaderForFile($file_name);
$excel    =   $reader->load($file_name);

Which versions of PhpSpreadsheet and PHP are affected?

Latest
1.4.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions