Describe the bug
openxlsx allows writing worksheet names that are not supported by Excel.
To Reproduce
- Save an example file:
library(openxlsx)
write.xlsx(
mtcars,
file = "~/test.xlsx",
sheetName = "mtcars/test"
)
- Open the file
- The error message says:
We found a problem with some content in ’test.xlsx’. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.
- When you try to manually include a
/ in a worksheet name within Excel, you get the message:
You've typed an invalid name for a sheet or chart. Make sure that:
• The name that you type does not exceed 31 characters.
• The name does not contain any of the following characters: : \ / ? * [ or ].
• You did not leave the name blank.
Expected behavior
write.xlsx should throw an error when any of the above characters are included in a worksheet name.
Desktop (please complete the following information):
Additional context
I'm happy to provide a PR if it should be done in the R code, possibly in buildWorkbook?
Describe the bug
openxlsxallows writing worksheet names that are not supported by Excel.To Reproduce
/in a worksheet name within Excel, you get the message:Expected behavior
write.xlsxshould throw an error when any of the above characters are included in a worksheet name.Desktop (please complete the following information):
openxlsx 4.2.3Additional context
I'm happy to provide a PR if it should be done in the
Rcode, possibly inbuildWorkbook?