profile
viewpoint

Ask questionsUndefined index $ : while importing excel file

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

PHPOffice/PhpSpreadsheet

Answer questions sidrafarooq

I am facing the same issue :(

i added above the way how to fix it and it is working all fine..

useful!
source:https://uonfu.com/
answerer
Sidra Farooq sidrafarooq Pakistan Coding => PHP (Laravel|Codeigniter|WordPress) Python (Django/AST) Amazon MWS & Selling Partner & Advertising API Elasticsearch Angular|Vue ML
Github User Rank List