0

I am trying to create and fill an excel sheet. First, I load a huge xlsx file with many sheets (test4.xlsx). Afterwards I create an empty sheet and than fill it out with a relatively large DataFrame (5000 rows and 80 columns). The first three lines of my code works flawless! At the end, I try to save the workbook, but unfortunately I get the following error(see below).

wb = openxlsx::loadWorkbook("test4.xlsx")
openxlsx::addWorksheet(wb, "New2")
openxlsx::writeDataTable(wb, sheet = "New2", out, startRow = 12)
openxlsx::saveWorkbook(wb, file = "test4.xlsx", overwrite = T)

**Error in fill$fillFg : $ operator is invalid for atomic vectors**

I tried to repilcate the same thing with an empty Workbook, all four lines work perfectly. Do you have an idea, what causes the error to appear? Have you already worked with multisheet excel files trying to add or update a particular sheet. XLSX package doesn't work as well, I get an error message:

**Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
  java.lang.OutOfMemoryError: Java heap space**

The output of traceback:

traceback()

5: .self$createFillNode(style)
4: .self$updateStyles(this.sty)
3: .self$preSaveCleanUp()
2: wb$saveWorkbook()
1: openxlsx::saveWorkbook(wb, file = "test4.xlsx", overwrite = T)
4

0 回答 0