2

I would like to export some result datasets to several sheets of a "template" xlsx file which is already pre-formatted (size, format of cells, filter on header, etc... already existing in the template). I just want to fill the template with the values (some equivalent of copy/paste only values from Excel).

I tried the xlsx / openxlsx packages but it doesn't work: this changes the styles of the worksheets.

I also tried the XLConnect package with the setStyleAction*(wb, XLC$"STYLE_ACTION.NONE")* setting, It only works for one of the sheets but not the others...

I am using R version 3.5.1 (32-bit) and Excel 2016

With openxlsx, I am using the code below :

Output_wb <- loadWorkbook(file = system.file("MyTemplate.xlsx"), package= "openxlsx"))
writeData(wb=Output_wb, sheet="Sheet1", Dataset2, xy = c(2,2), colNames = FALSE, rowNames = FALSE)
## Save workbook
saveWorkbook(Output_wb, "Summary_of_results.xlsx"), overwrite = TRUE)
lovalery
  • 4,524
  • 3
  • 14
  • 28
MaRius
  • 21
  • 4
  • Could you show the code you tried using `openxlsx`? And describe what happens ("changes the styles of the worksheets")? I'm using this package for the same task frequently and have no problems. – huan Dec 12 '18 at 11:51

0 Answers0