How to insert a blank column or row in Excel using XLSX or XLConnect

How can I insert a blank row or column into an Excel sheet, moving the data already contained in the sheet down or to the right, as needed? My pre-existing tables are linked to graphs in the Excel, so the new columns/rows need to be inserted in the middle to preserve the graphs.

I have tried to achieve this using createRow (from xlsx package) but got the following error message: "Error in .jcall(sheet, "Lorg/apache/poi/ss/usermodel/Row;", "createRow", : RcallMethod: cannot determine object class".

# Load workbook
wb <- loadWorkbook("test.xlsx")

#get sheets
sheets <- getSheets(wb)

#create row
row <- createRow(sheet = "Sheet1", rowIndex = 12:14)

A similar question was posted here last year. @cole responded and indicated that it is possible but difficult. Any pointers would be appreciated. @cole, if possible, can you elaborate on your response to the linked post ("You definitely can do this latter approach, but it will likely require a bit of ugly programming on your part.")?

Thank you!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.