Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spreadsheet getNamedRange returns null (1.5.0) #739

Closed
shashane opened this issue Oct 23, 2018 · 5 comments
Closed

Spreadsheet getNamedRange returns null (1.5.0) #739

shashane opened this issue Oct 23, 2018 · 5 comments

Comments

@shashane
Copy link

This is:

- [X] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Retriveing named ranges from xlsx file.

What is the current behavior?

namedRanges array in Spreadsheet object is empty

Works fine in 1.4.1.
Breaking change on 1.5.0.

What are the steps to reproduce?

<?php

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

// Create new Spreadsheet object

$spreadsheet = IOFactory::load('My File.xlsx');
$range = $spreadsheet->getNamedRange('Range Name');
// 'My File.xlsx' contains a named range 'Range Name'
// $range is null
 

Which versions of PhpSpreadsheet and PHP are affected?

PhpSpreadsheet v1.5
Php 5.6.33

@guillaume-ro-fr
Copy link
Contributor

I have exactly the same problem. Can you check if your worksheet title contains the ' character in your xlsx file for the defined named range ?

In debug mode, I found that extractSheetTitle don't works as expected :

Expected in the documentation :

extractSheetTitle("'testSheet 1'!A1", true) === ["testSheet 1", "A1"];

Actual :

extractSheetTitle("'testSheet 1'!A1", true) === ["'testSheet 1'",  "A1"];

The name in $pRange is for example 'Analyse du 1 Janvier 2018' and getTitle() return Analyse du 1 Janvier 2018.

guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Oct 26, 2018
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Oct 28, 2018
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Oct 29, 2018
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Oct 29, 2018
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Nov 6, 2018
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Nov 12, 2018
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
@stale
Copy link

stale bot commented Dec 25, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Dec 25, 2018
@stale stale bot closed this as completed Jan 1, 2019
@eigan
Copy link
Contributor

eigan commented Jan 10, 2019

See attached image from xdebug. PHPSpreadsheet is no longer able to get the proper Worksheet.

This started happening after we upgraded from 1.4.1 to 1.5.0 (same as OP)

2019-01-10_894x731

Can we reopen this issue?

@eigan
Copy link
Contributor

eigan commented Jan 10, 2019

Stacktrace:
2019-01-10_748x63

src/PhpSpreadsheet/Reader/Xlsx.php
2019-01-10_423x92

@cwerner1 cwerner1 mentioned this issue Feb 19, 2019
5 tasks
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Jun 11, 2019
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Jun 12, 2019
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Jun 12, 2019
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
PowerKiKi added a commit that referenced this issue Aug 17, 2019
1.9.0

### Added

- When &lt;br&gt; appears in a table cell, set the cell to wrap [#1071](#1071) and [#1070](#1070)
- Add MAXIFS, MINIFS, COUNTIFS and Remove MINIF, MAXIF [#1056](#1056)
- HLookup needs an ordered list even if range_lookup is set to false [#1055](#1055) and [#1076](#1076)
- Improve performance of IF function calls via ranch pruning to avoid resolution of every branches [#844](#844)
- MATCH function supports `*?~` Excel functionality, when match_type=0 [#1116](#1116)
- Allow HTML Reader to accept HTML as a string [#1136](#1136)

### Fixed

- Fix to AVERAGEIF() function when called with a third argument
- Eliminate duplicate fill none style entries [#1066](#1066)
- Fix number format masks containing literal (non-decimal point) dots [#1079](#1079)
- Fix number format masks containing named colours that were being misinterpreted as date formats; and add support for masks that fully replace the value with a full text string [#1009](#1009)
- Stricter-typed comparison testing in COUNTIF() and COUNTIFS() evaluation [#1046](#1046)
- COUPNUM should not return zero when settlement is in the last period [#1020](#1020) and [#1021](#1021)
- Fix handling of named ranges referencing sheets with spaces or "!" in their title
- Cover `getSheetByName()` with tests for name with quote and spaces [#739](#739)
- Best effort to support invalid colspan values in HTML reader - [#878](#878)
- Fixes incorrect rows deletion [#868](#868)
- MATCH function fix (value search by type, stop search when match_type=-1 and unordered element encountered) [#1116](#1116)
- Fix `getCalculatedValue()` error with more than two INDIRECT [#1115](#1115)
- Writer\Html did not hide columns [#985](#985)
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Jul 20, 2020
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Nov 24, 2020
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Nov 24, 2020
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Dec 2, 2020
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Jan 15, 2021
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Dec 1, 2021
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
guillaume-ro-fr added a commit to guillaume-ro-fr/PhpSpreadsheet that referenced this issue Feb 22, 2024
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
@oleibman
Copy link
Collaborator

Appears to have been fixed in 09ab584 in August 2019.

@oleibman oleibman removed the stale label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants