2

I wanted to write out some data to xlsx file using a template xlsx file with pre-designed formatting. I have already read the previous question: "Write from R into template in excel while preserving formatting". But the answer propose the use of XLConnect package which is not compatible with my environment as I am already using xlsx package. These two packages cannot be loaded at the same time due to the different Apache POI versions.

I wanted to ask what equivalent functions may exist outside the XLConnect package to loadWorkbook or setStyleAction which was mentioned as answer in the previous question as follows:

wb <- loadWorkbook("test.xlsx", create=TRUE)
setStyleAction(wb,XLC$"STYLE_ACTION.NONE")
Enoana
  • 55
  • 2
  • 6
  • 1
    There is a package called `xlsx` that uses similar syntax. I don't know of many other packages that allow you to write to excel files – Rohit Aug 27 '18 at 12:06
  • The question you mentioned does mention (https://stackoverflow.com/questions/11228942/write-from-r-into-template-in-excel-while-preserving-formatting#comment62387850_11229726) package `openxlsx` (https://www.rdocumentation.org/packages/openxlsx/versions/4.1.0/topics/addStyle) – Mike Badescu Aug 27 '18 at 15:26
  • I'll second- The `openxlsx` package is the most flexible that I've found to write to a file with formatting. Use `createStyle` and then `addStyle` to the wb. I changed my code so that I don't load any of the other xl-related packages. – Matt L. Aug 27 '18 at 20:45

0 Answers0