write_multi_tabbed_xlsx: Easily Make Multi-tabbed .xlsx Files with openxlsx

View source: R/write_multi_tabbed_xlsx.R

write_multi_tabbed_xlsxR Documentation

Easily Make Multi-tabbed .xlsx Files with openxlsx

Description

Wrapper for some steps using openxlsx package to write multiple to multiple tabs in an Excel spreadsheet. Apparently, openxlsx::write.xlsx() will accomplish the same thing. I just found this out. I use this other method so regularly that I still feel like saving it here for posterity.

Usage

write_multi_tabbed_xlsx(tab_names, list_of_dfs, file_path, over_write = TRUE)

Arguments

tab_names

Character vector of names for the tabs in the Excel spreadsheet.

list_of_dfs

A list of data frames to write to file.

file_path

Path and filename to write to.

over_write

Logical. Overwrite the existing file of the same name. Default is TRUE

Value

A workbook object

References

Examples

## Not run: 
dat <- split(mtcars, mtcars$cyl)
dat

write_multi_tabbed_xlsx(tab_names = c("4 cyl", "6 cyl", "8 cyl"),
                        list_of_dfs = dat,
                        file_path = "C:/Users/latour/Desktop/cylinders.xlsx",
                        over_write = TRUE)

## End(Not run)

emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.