[GH-ISSUE #223] Worksheet names ending in single-quote aren't raising an error #180

Closed
opened 2026-05-05 11:50:32 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @mewalig on GitHub (Apr 10, 2019).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/223

Originally assigned to: @jmcnamara on GitHub.

If a worksheet is created using a name where the final char is a single-quote, libxlsxwriter should raise an error, but does not. The below screenshots show

  1. Excel complaining if you try to do this by renaming a worksheet manually and
  2. Excel not complaining using the same name, if the final char is not a single-quote

The screenshots use a name of 31 chars but it appears that the issue exists whenever the name ends in single quote

image

image

Originally created by @mewalig on GitHub (Apr 10, 2019). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/223 Originally assigned to: @jmcnamara on GitHub. If a worksheet is created using a name where the final char is a single-quote, libxlsxwriter should raise an error, but does not. The below screenshots show 1. Excel complaining if you try to do this by renaming a worksheet manually and 2. Excel not complaining using the same name, if the final char is not a single-quote The screenshots use a name of 31 chars but it appears that the issue exists whenever the name ends in single quote ![image](https://user-images.githubusercontent.com/8260442/55894365-f9baeb00-5b87-11e9-967f-3a33c580359b.png) ![image](https://user-images.githubusercontent.com/8260442/55894668-8665a900-5b88-11e9-8d5f-b045f5c45786.png)
gitea-mirror 2026-05-05 11:50:32 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@jmcnamara commented on GitHub (Apr 10, 2019):

Thanks. That is a bug.

<!-- gh-comment-id:481779991 --> @jmcnamara commented on GitHub (Apr 10, 2019): Thanks. That is a bug.
Author
Owner

@RaFaeL-NN commented on GitHub (Apr 11, 2019):

Single-quote cannot be the first char too

<!-- gh-comment-id:482268805 --> @RaFaeL-NN commented on GitHub (Apr 11, 2019): Single-quote cannot be the first char too
Author
Owner

@jmcnamara commented on GitHub (Apr 15, 2019):

For the record the limitations on worksheet naming are given here:

Important: Worksheet names cannot:

  • Be blank .

  • Contain more than 31 characters.

  • Contain any of the following characters: / \ ? * : [ ]. For example, 02/17/2016 would not be a valid worksheet name, but 02-17-2016 would work fine.

  • Begin or end with an apostrophe ('), but they can be used in between text or numbers in a name.

  • Be named "History". This is a reserved word Excel uses internally.

<!-- gh-comment-id:483252454 --> @jmcnamara commented on GitHub (Apr 15, 2019): For the record the limitations on worksheet naming are given [here](https://support.office.com/en-ie/article/rename-a-worksheet-3f1f7148-ee83-404d-8ef0-9ff99fbad1f9): > **Important: Worksheet names cannot:** > > * Be blank . > > * Contain more than 31 characters. > > * Contain any of the following characters: `/ \ ? * : [ ]`. For example, 02/17/2016 would not be a valid worksheet name, but 02-17-2016 would work fine. > > * Begin or end with an apostrophe ('), but they can be used in between text or numbers in a name. > > * Be named "History". This is a reserved word Excel uses internally.
Author
Owner

@jmcnamara commented on GitHub (Jun 6, 2019):

Fixed on master. The function now returns LXW_ERROR_INVALID_SHEETNAME_CHARACTER if the worksheet name starts on ends with an apostrophe.

<!-- gh-comment-id:499699316 --> @jmcnamara commented on GitHub (Jun 6, 2019): Fixed on master. The function now returns `LXW_ERROR_INVALID_SHEETNAME_CHARACTER` if the worksheet name starts on ends with an apostrophe.
Author
Owner

@jmcnamara commented on GitHub (Jun 7, 2019):

Changed the function to return an error specific code: LXW_ERROR_SHEETNAME_START_END_APOSTROPHE.

<!-- gh-comment-id:499942124 --> @jmcnamara commented on GitHub (Jun 7, 2019): Changed the function to return an error specific code: `LXW_ERROR_SHEETNAME_START_END_APOSTROPHE`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#180
No description provided.