Invalid character found in sheet code name

Topics: User Forum
Jan 16, 2015 at 3:16 AM
Edited Jan 16, 2015 at 3:54 AM
Just getting the hang of things with extracting data from ODS and echoing to terminal with PHP, and I ran into the above throw immediately.

PHPExcel 1.8.0, PHP 5.3.3 on Plesklinux via my web provider

I have a spreadsheet for financial tracking which has a single sheet in it, the title of which contains only valid characters, and fewer than 31 of them.

My problem is I cannot pull any data from the sheet as I get thrown the error from Worksheet.php every time. A web search and someone else's hack around the problem led me to uncover the real culprit.

Maybe my assumption that the error should pertain only to the title of the sheet is wrong, but the error is thrown in my case because many cells in my spreadsheet directly reference cells in another file on my local hard drive. Those references of course would have all manner of 'invalid characters' if they were treated as names.

The hack I found is from here:

which basically removes the 'throw' directive and replaces it with this:
return str_replace(self::$_invalidCharacters, '', $pValue);

It seems to work on the surface, to get around the file references contained within the cells of my spreadsheet.

My questions are: 1) Is there a better way? I am not much of a PHP coder so I do not really understand what the above code even does, but on a general level.
2) Will this hack create problems with other functions of the classes?

I really cannot get around having references to cells in other files without a ton of work, so I hope there is a more elegant way to handle such things with PHPExcel and come out functional in the end.

Thanks for any thoughts on the matter.