Cannot open the file after writing xlsx file using R openxlsx package
Asked Answered
S

0

8

At first, I tried to read and write xlsx files in R (while comparing the output between the xlsx and openxlsx packages).

I work on mac os.

It worked well to read xlsx files using the read.xlsx() from both packages. However, when it comes to writing a new file, only the xlsx::write.xlsx() worked.

To be more exact, the openxlsx::write.xlsx() command gave no error, and an xlsx file was successfully saved, but when I tried to open the file using Numbers (by double clicking on the file in the folder), an error message popped up telling me the file cannot be opened.

I tried different data frames, but the results remained the same. To show an example, please refer to the following line which I took directly from R help page. It should work but does not work for me.

write.xlsx(iris, file = "writeXLSX1.xlsx", colNames = TRUE, borders = "columns")

Anyone tell me what the problem is? I tried to google for old threads but it seems no one is discussing this problem. I know in many similar threads people suggested changing packages, okay...before that, can you tell me what the limitations of openxlsx are?

Sportive answered 11/6, 2017 at 3:1 Comment(7)
Not able to reproduce the problem with openxlsx_4.0.17 on R 3.4.0Mattias
well, I then updated my R to 3.4.0. Did not work though.Sportive
i am not sure why it is not working for you.Mattias
so it's just me? I tried it on windows and it works fine.Sportive
I am also using windows. Thanks for sharing that infoMattias
Same issue here: Files can be opened with Excel, but not with Numbers or Preview.Sussman
I raised a ticket: github.com/awalker89/openxlsx/issues/316Sussman

© 2022 - 2024 — McMap. All rights reserved.