Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WriteData cannot find sheet whose name contains "<" sign #78

Closed
shengchaohou opened this issue Jun 9, 2020 · 2 comments
Closed

WriteData cannot find sheet whose name contains "<" sign #78

shengchaohou opened this issue Jun 9, 2020 · 2 comments
Labels

Comments

@shengchaohou
Copy link

@shengchaohou shengchaohou commented Jun 9, 2020

Describe the bug
writeData function cannot find a sheet whose name contains "<" sign.

To Reproduce

library(openxlsx)
sheetname = "<24h"
wb <- createWorkbook()
addWorksheet(wb, sheetname)
writeData(wb, sheetname, "test")
Error: Sheet '<24h' does not exist.

Expected behavior
Write data to the assigend sheet.

Desktop (please complete the following information):

sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4

packageVersion("openxlsx")
[1] ‘4.1.5’

@ycphs ycphs added the bug label Jun 9, 2020
@jsavn
Copy link

@jsavn jsavn commented Jul 17, 2020

I've experienced the same issue but posted at the old repo: (awalker89/openxlsx#508)

Using openxslsx version 4.1.5 and R 4.0.0.

See below example:

wb <- openxlsx::createWorkbook()
openxlsx::addWorksheet(wb, sheet = "a < 1")  # this works
openxlsx::writeData(wb, sheet = "a < 1", jams)  # this returns an error

I can add a worksheet containing a special character, but when using writeData(), the sheet name first gets validated using validateSheet() which renames special characters using replaceIllegalCharacters(), but then checks against the existing sheet names (containing said character) and doesn't find the matching sheet. I don't know why the characters get replaced in one method but not the other?

@ycphs
Copy link
Owner

@ycphs ycphs commented Aug 10, 2020

it is solved in the current dev version

@ycphs ycphs added the fixed label Aug 10, 2020
@ycphs ycphs closed this Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.