Reputation: 495
I am trying to write a xlsx file on MAC using the following the code.
rm(list=ls())
library(openxlsx)
fn<-“RTest.xlsx”
wb<-createWorkbook()
HomeSheet = addWorksheet(wb,“Home”)
writeData(wb,HomeSheet,“R Test”,startCol = 2,startRow = 2)
saveWorkbook(wb,fn,overwrite = T)
When I try to open the using the Numbers app, it says file format invalid. But I tried opening another xlsx file that was manually created, it was able to open it.
I am not sure if there is something wrong with the code or if there is something that I am missing. I am new to MAC so dont have much idea about it.
Upvotes: 1
Views: 317
Reputation: 4243
library(XLConnect)
wb = loadWorkbook("RTest.xlsx")
new_dataset = readWorksheet(wb, sheet = "Home", header = TRUE)
Upvotes: 1