Writes each table in the RCDF object as a separate .xlsx file using the openxlsx package.
Usage
write_rcdf_xlsx(
data,
path,
...,
parent_dir = NULL,
as_single_file = FALSE,
file_name = NULL
)Arguments
- data
A valid RCDF object.
- path
The output directory.
- ...
Additional arguments passed to
openxlsx::write.xlsx().- parent_dir
Optional subdirectory under
pathto group Excel files.- as_single_file
Whether to export all records (items in the RCDF list) in a single file where each item will be written per sheet in the workbook.
- file_name
File name to assign when
as_single_fileis set toTRUE.
Examples
dir <- system.file("extdata", package = "rcdf")
rcdf_path <- file.path(dir, 'mtcars.rcdf')
private_key <- file.path(dir, 'sample-private-key-pw.pem')
rcdf_data <- read_rcdf(path = rcdf_path, decryption_key = private_key, password = '1234')
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#> ℹ /tmp/RtmpJoKwXx/duckdb
#> This is removed when the R session ends.
#> • Extensions are re-downloaded each session.
#> • Secrets are lost.
#> ℹ Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#> ℹ Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#> ℹ See ?duckdb_storage for details and alternatives.
temp_dir <- tempdir()
write_rcdf_xlsx(data = rcdf_data, path = temp_dir)
unlink(temp_dir, force = TRUE)