XLconnect cell style not preserverd R

22 Views Asked by At

I'm using the 'XLconnect' package in R to write data to a .xlsx file. I use this package because I have predefined style in my workbook which I want to preserve. I used this before in other projects where it worked fine, but now it doesn't seem to work. My predefined workbook looks like this;

enter image description here

The code I use (as example) is as follows;

library(stringr)
library(XLConnect)
library(rJava)

test <- c(1,2,3,4,5,6)
wb <- loadWorkbook("COS_OVERVIEW.xlsx", create = TRUE)
setStyleAction(wb, XLC$STYLE_ACTION.NONE)
writeWorksheet(wb, test, "Overview", startRow = 2, startCol = 1, header = F)
saveWorkbook(wb)
xlcFreeMemory()
gc()

But the the output looks like this;

enter image description here

Any help would be greatly appreciated!

Kind regards

0

There are 0 best solutions below