link excel to r
#XLConnect Package
library(XLConnect)
##Build Connection to excel
x <- loadWorkbook("data.xlsx")
##Get Sheet name
getSheets("data.xlsx")
#Read Sheet
readWorksheet("data.xlsx", sheet = 2,
startRow = 3, endRow = 5,
startCol = 2, endCol = 4,
header = FALSE)
# Add a worksheet to x
createSheet(x, "data_summary")
# Remove the fourth sheet
removeSheet(my_book, 4) # 4 is interchangeable with sheet name
# Add data in summ to "data_summary" sheet
writeWorksheet(x, data = summ, sheet = "data_summary")
# Rename "data_summary" sheet to "summary"
renameSheet(x, "data_summary", "summary")
# Save workbook as summary.xlsx
saveWorkbook(x "summary.xlsx")