Mike
Mike

Reputation: 1069

Exporting output from R into an open Excel workbook

I've found the package XLConnect to be useful for exporting matrices to a CLOSED workbook, but does anyone know how to write to an OPEN workbook?

Alternatively, does anyone know of code one can write in VBA to import a matrix from an R script file?

Thanks

Mike

Upvotes: 3

Views: 1627

Answers (2)

David Jorquera
David Jorquera

Reputation: 2102

I've been wanting to do just this and stumbled upon excel.link that writes easily into an active excel sheet. The method to write is very simple and straightforward:

library(excel.link)
xlrc[a1] <- seq(1, 10) 

Note that inside the brackets you write the cell where the data will be written (if it is a dataframe, this cell will be the upper left of said dataframe).

Result in the active sheet of the active excel file:

enter image description here

Upvotes: 3

user4644962
user4644962

Reputation: 21

Use package excel.link this can work with xlsm and also with open excels..

Upvotes: 2

Related Questions