Search code examples
rxlsxopenxlsxwritexl

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
)

Solution

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