Connect Excel With R
# Connecting Excel with R
# XLConnect is package in R that is used create Spreadsheet.
# It is dynamic report of R analysis.
# install the package XLConnect and subsequently the library
CREATE A WORKBOOK
# Lets first create the path where we would like to store the excel file and name it as fileXls.
# unlink command is to delete the files and directories Specified by x, i.e x=fileXls.
# Then command loadWorkbook is used creates an R workbook object.
# createSheet command is used to create a sheet named "Input".
# saveWorkbook command save the R object in an xlsx file.
>unlink(fileXls,recursive = FALSE,force = FALSE)
>exc=loadWorkbook(fileXls,create = TRUE)
FILL DATA WITHIN THE FILE
# data.frame is used to create rows and columns with values.
# writeWorksheet writes the content of this data in the input sheet from the cell(1,2)
# saveWorkbook will save the content.
>writeWorksheet(exc,input,sheet = "input",startRow = 1,startCol = 2)