open_xlsx: Using openxlsx to Create or Update an Excel Workbook

Description Usage Arguments Value Examples

Description

open_xlsx will take a single data frame or a list of data frames, as well as a vector of worksheet names and a workbook name, to create or update an excel xlsx file with each data frame on a seperate worksheet within the file

Usage

1
2
open_xlsx(nameVector, tableList, workBookName, colNames = TRUE,
  rowNames = FALSE, loadWorkBook = FALSE, replaceSheets = FALSE)

Arguments

nameVector

a single string or a vector of strings

tableList

a single data frame or a list of data frames

workBookName

a string

colNames

a boolean; default = TRUE

rowNames

a boolean; default = FALSE

loadWorkBook

a boolean; default = FALSE

replaceSheets

a boolean; default = FALSE

Value

.xlsx file

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 
# Name the sheets
nameVec1 <- c("1", "2", "3")
nameVec2 <- c("4", "5", "6")
nameVec3 <- c("3", "5", "7")

a <- data.frame(1:3, 4:6, 7:9)
b <- data.frame(10:12, 13:15, 16:18)
tableList1 <- list(a, a, a)
tableList2 <- list(b, b, a)

open_xlsx("1", a, "test")
open_xlsx(nameVec1, tableList1, "test")
open_xlsx(nameVec2, tableList1, "test", loadWorkBook = TRUE)
open_xlsx(nameVec3, tableList2, "test", loadWorkBook = TRUE, replaceSheets = TRUE)

file.remove("test.xlsx")

HanjoStudy/quotidieR documentation built on May 5, 2019, 6:13 p.m.