xlsx2dfs: Read-in Excel file (workbook) as a list of data frames.

Description Usage Arguments Value Examples

View source: R/xlsx2dfs.R

Description

Read-in Excel file (workbook) as a list of data frames.

Usage

1
xlsx2dfs(xlsxPath, rowNames = TRUE, colNames = TRUE, ...)

Arguments

xlsxPath

A path to the Excel file, a character.

rowNames

Whether to read-in row names, a boolean.

colNames

Whether to read-in column names, a boolean.

...

... passed to read.xlsx function in the openxlsx package.

Value

A list of data frames, each representing a sheet in the Excel file (sheet names are list element names).

Examples

1
2
3
4
5
6
7
8
# create example file
df1 <- data.frame(A=c(1, 2), B=c(3, 4))
df2 <- data.frame(C=c(5, 6), D=c(7, 8))
xlsx_fpath <- file.path(tempdir(), "testout.xlsx")
dfs2xlsx(withNames("sheet1", df1, "sheet2", df2), xlsx_fpath)
# read created file
dfs <- xlsx2dfs(xlsx_fpath)
file.remove(xlsx_fpath)

Example output

Loading required package: openxlsx
[1] TRUE

xlsx2dfs documentation built on Oct. 11, 2019, 5:06 p.m.