0

My goal is to construct an Excel spreadsheet that contains all of the formatting for my data and to only use openxlsx via R to write dataframes to the file. However, when I tried to do so, the formatting in the file is overwritten. I am calling the function in this manner:

writeDataTable(wb,1,wl, 1,2,colNames=FALSE, rowNames=FALSE, 
               tableStyle="none", withFilter = FALSE, 
               bandedRows=FALSE, stack = TRUE)  

Please advise. thanks

John Smith
  • 51
  • 6

1 Answers1

0

I'll suggest that writeDataTable may be the cause of your problem as it applies formatting by definition.

Write to a worksheet and format as an Excel table

I recommend testing with writeData.

Ben Jacobson
  • 83
  • 1
  • 9
  • It doesn't seem to work. When I try, writeData(wb=wb, sheet=1, x=wl, startCol=1,startRow=2,colNames=FALSE,rowNames=FALSE, borders="none" ) the formatting is overridden. – John Smith Oct 09 '17 at 16:29
  • 1
    Perhaps more info is needed, like a reproducible example. Using writeData works for me consistently. Unless I have filters on the target Excel range. `writeData(wb, "RANK by ITEM", x, startRow = 3, colNames = FALSE)` – Ben Jacobson Oct 09 '17 at 16:58