openxlsx icon indicating copy to clipboard operation
openxlsx copied to clipboard

getTables - character & changing on sheet name

Open allanbides opened this issue 4 years ago • 3 comments

Hello, guys,

I am using the function getTables, to discover the tables on Sheet "T&O", but I receive the message that this sheet does not exist, because the function in some way looks for the sheet 'T& amp;O' , changing the '&' by ' & amp;'(even here it was hard to write, I needed to put a space)

 getTables(wb,"T&O")
 Error: Sheet 'T&O' does not exist.

Any suggestions?

Thanks in advance!

Allan

sessionInfo()

  • Version of openxlsx: 4.1.4
  • Version of R: 3.4.3

allanbides avatar Apr 14 '20 23:04 allanbides

I'm experiencing the same issue with openxslsx version 4.1.5 and R 4.0.0! I get the error with & and < characters, when with a previous version they worked fine (just updated today so not sure what version I was using previously).

jsavinc avatar Jun 09 '20 16:06 jsavinc

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?

jsavinc avatar Jun 09 '20 17:06 jsavinc

Hi,

That is the old repository for this R Package.

Please use the new one:

https://github.com/ycphs/openxlsx

ycphs avatar Jul 17 '20 07:07 ycphs