[R] RCOM Package

Thomas Sudler thsudler at bluewin.ch
Thu Jun 29 21:10:35 CEST 2006


Hi list,

I just installed the rcom package and tried to read/give out some values 
from/to Excel. Altogether it works great... but nevertheless I don't know 
how the syntax works or in other words: "Which command needs which 
parameters?"

Is there somwhere a manual about this package with good examples? I've read 
the Package description... but there are not really good 
descriptions/examples.

I know the following parameters/commands:

#Connect to the active Workbook
excel <- comGetObject("Excel.Application")

#Set the active sheet
sheet <- comGetProperty(excel,"ActiveSheet")

#Set a specific sheet
sheet <- comGetProperty(excel,"Worksheets","WorksheetXY")

#Create a new Worksheet
comInvoke(comGetProperty(excel,"Worksheets"),"Add")

#Define a range in a defined sheet
range1 <- comGetProperty(sheet,"Range","A1","A20")

#Read out this range from Excel
val1 <- as.double(comGetProperty(range1,"Value"))

#Give back the results to Excel
comSetProperty(range1,"Value",val1)

Some of my questions are:

- How can I rename a worksheet?
- How can I define the name of a new worksheet?
- How can I delete a worksheet?
- How can I connect to a specific Workbook, if more than one is opened?
- ...

Can someone help me?

Thanks,
Thomas



More information about the R-help mailing list