Long_NgV
Long_NgV

Reputation: 475

Write file xlsx in R without using Java

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
)

Upvotes: 5

Views: 2020

Answers (2)

rBw77
rBw77

Reputation: 11

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.

Upvotes: 1

L77
L77

Reputation: 137

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")

Upvotes: 5

Related Questions