Write file xlsx in R without using Java
Asked Answered
K

2

5

wight now I'having an issue with R. I could not use library openxlsx in my PC. When I try to import, these errors show me that:

Error: package or namespace load failed for ‘openxlsx’:
 object ‘zipr’ is not exported by 'namespace:zip'

Any one suggest me some different method to save file in xlsx format. I tried writexl package, however I don't know how to save file in seperate worksheets, the description of the function write_xlsx in this package only show me this:

write_xlsx(
  x,
  path = tempfile(fileext = ".xlsx"),
  col_names = TRUE,
  format_headers = TRUE
)
Kora answered 3/3, 2020 at 4:13 Comment(0)
L
5

Can you use the WriteXLS package?

WriteXLS(x, ExcelFileName = paste0(tempfile, ".xlsx"), SheetNames = NULL, row.names = FALSE, col.names = TRUE)

Edit: If you're trying to save data to different sheets, turn your data into a list:

mySheets = c("data1", "data2")
Legislator answered 3/3, 2020 at 4:24 Comment(0)
K
1

In case you would like to continue using openxlsx library in order to save in xlsx format and with different worksheets, you can solve the namespace error by upgrading the zip package to latest version v2.1.0, same issue as posted here. The zip package is a dependency of openxlsx.

Kerek answered 5/9, 2020 at 15:8 Comment(3)
@help-info.de I'm not sure I understand. Is this answer not different from the other answer? Or are you saying that one should not answer Questions that already has an accepted Answer?Newsman
@Scrattle - my comment ist a hint only for reading the question carefully. Any answer that gets the asker going in the right direction is helpful.Madoc
@Madoc Thank you for your suggestions and comments. I have edited the reply so as to clarify better. I believe the answer gives the user and additional way of solving the problem, namely saving to an xlsx file with different worksheets.Kerek

© 2022 - 2024 — McMap. All rights reserved.