Phpspreadsheet: Invalid character found in sheet title

Created on 21 Jun 2019  路  1Comment  路  Source: PHPOffice/PhpSpreadsheet

This is:

- [ ] 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)

Which versions of PhpSpreadsheet and PHP are affected?

1.7.0

My sheet title contain "/" e.g "test Title/B2" and it cause this error.
I don't know what else character cause this error too.
How do I solved it. User should be input what ever they want.
Sorry for my bad english

Most helpful comment

No! Users ____shouldn't____ be able to input whatever they want; because MS Excel has rules for the naming of worksheets:

  • Two worksheets cannot have the same name, regardless of upper or lowercase. Excel will return the error: Cannot rename a sheet to the same name as another sheet, a referenced object library or a workbook referenced by Visual Basic.
  • A worksheet name cannot cannot exceed 31 characters.
  • A worksheet name cannot be left blank.
  • A worksheet cannot be named history in either lower or uppercase. History is reserved by Excel for tracking changes between shared workbooks.
  • Any letter from A to Z, and any number from 0 to 9 can be used.
  • The following character symbols are allowed, but if the worksheet name contains a blank or any of these characters, the name must be wrapped in single quotes when manually entering formulas to link worksheet data.

    • ~ ! @ # $ % ^ & ( ) - _ = + { } | ; : , < . >

    • The apostrophe (' ) cannot be used at the beginning or end of a worksheet name, but can be used in the middle of a name.

    • The following characters are forbidden for use when naming worksheets. Excel will not even allow you to type them:

    • \ / ? * [ ] :

>All comments

No! Users ____shouldn't____ be able to input whatever they want; because MS Excel has rules for the naming of worksheets:

  • Two worksheets cannot have the same name, regardless of upper or lowercase. Excel will return the error: Cannot rename a sheet to the same name as another sheet, a referenced object library or a workbook referenced by Visual Basic.
  • A worksheet name cannot cannot exceed 31 characters.
  • A worksheet name cannot be left blank.
  • A worksheet cannot be named history in either lower or uppercase. History is reserved by Excel for tracking changes between shared workbooks.
  • Any letter from A to Z, and any number from 0 to 9 can be used.
  • The following character symbols are allowed, but if the worksheet name contains a blank or any of these characters, the name must be wrapped in single quotes when manually entering formulas to link worksheet data.

    • ~ ! @ # $ % ^ & ( ) - _ = + { } | ; : , < . >

    • The apostrophe (' ) cannot be used at the beginning or end of a worksheet name, but can be used in the middle of a name.

    • The following characters are forbidden for use when naming worksheets. Excel will not even allow you to type them:

    • \ / ? * [ ] :

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isopen picture isopen  路  3Comments

garnold picture garnold  路  5Comments

Typel picture Typel  路  5Comments

leandrogm picture leandrogm  路  5Comments

cheinle picture cheinle  路  3Comments