Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

"Sheet index is out of bounds." Exception #80

Closed
dbonsch opened this issue Nov 16, 2012 · 9 comments
Closed

"Sheet index is out of bounds." Exception #80

dbonsch opened this issue Nov 16, 2012 · 9 comments
Milestone

Comments

@dbonsch
Copy link
Member

dbonsch commented Nov 16, 2012

Especially if you have more than one sheet this error message does not really help to much.

Please add the requested $pIndex and the actual amount of sheets to the error message. That would help to find errors faster.

@Progi1984
Copy link
Member

An example code ?

@dbonsch
Copy link
Member Author

dbonsch commented Nov 16, 2012

is thrown in
PHPExcel::removeSheetByIndex line: 261
PHPExcel::getSheet line: 283

$this->_workSheetCollection was empty ( still not shure how that could happen ) and i searched for a long time which sheet was missing, just to realize that $this->_workSheetCollection was empty.

I've commited a version with the extended messages in my fork.

@karak
Copy link
Contributor

karak commented Nov 29, 2012

I had met this error too.
And I concluded it was bug the way to adjust active sheet index in removeSheetByIndex() then.
I hope my fix could also help you.

Present:
// this condition misses when active sheet is not at last
if (($this->_activeSheetIndex >= $pIndex) &&
($pIndex > count($this->_workSheetCollection) - 1)) {
--$this->_activeSheetIndex;
}

Fixed:
if (($this->_activeSheetIndex >= $pIndex) &&
($this->_activeSheetIndex > 0)) {
--$this->_activeSheetIndex;
}

@karak
Copy link
Contributor

karak commented Nov 29, 2012

Sorry to have miss the point of your message.

@dbonsch
Copy link
Member Author

dbonsch commented Nov 29, 2012

You don't need to apologize. Thx for trying to help me. :-)

@JaceTan
Copy link

JaceTan commented Feb 26, 2013

Hi I've got this error too.

However, commenting out lines 1717 to 1780 in PHPExcel/Reader/Excel2007.php (somewhat) solves this problem. We can now upload and process our sheets nicely.

Not sure if the removal of these lines will affect future codes.

Is there another fix? Possibly one that will be updated in the next version of PHPExcel?

We've also posted this in PHPExcel Codplex here: http://phpexcel.codeplex.com/discussions/249093

We're using version 1.7.8.

Thanks!

@huanggaoyuan2016
Copy link

Completely ignorant than

@iamMarkchu
Copy link

i use 1.7.4 version , the only way to solve 'Sheet index is out of bounds' this problem is to updated phpexcel?

@PowerKiKi
Copy link
Member

1.7.4 was released on the 2010-08-26, almost 7 years ago. You should absolutely upgrade.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants