Saves any extracted and/or transformed data as separate sheet of an xlsx file.

dettl_save(import, file, stage)

Arguments

import

The import object to save the data for.

file

File path at which to save the data.

stage

The stage or stages to save. 'extract' and/or 'transform'

Examples

path <- dettl:::prepare_test_import(
  system.file("examples", "person_information", package = "dettl"),
  system.file("examples", "dettl_config.yml", package = "dettl")
)
import <- dettl::dettl(file.path(path, "person_information"), "test")
import$extract()
#> Running extract /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a975df1cf1/person_information
#> Running extract tests R/test_extract.R
#>  | F W S  OK | Context
#> 
#> ⠏ |         0 | extract                                                         
#> ⠏ |         0 | extract                                                         
#>  |         1 | extract
#> 
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All extract tests passed.
import$transform()
#> Running transform /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpiqOfW1/file14a975df1cf1/person_information
#> Running transform tests R/test_transform.R
#>  | F W S  OK | Context
#> 
#> ⠏ |         0 | transform                                                       
#> ⠏ |         0 | transform                                                       
#>  |         1 | transform
#> 
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
#> All transform tests passed.
t <- tempfile()
dettl::dettl_save(import, t, "extract")
#> Saved extract data to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpiqOfW1/file14a9ae54eac
t2 <- tempfile()
dettl::dettl_save(import, t2, "transform")
#> Saved transform data to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpiqOfW1/file14a97c440c27
t3 <- tempfile()
dettl::dettl_save(import, t3, c("extract", "transform"))
#> Saved extract data to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpiqOfW1/file14a96726021b
#> Saved transform data to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpiqOfW1/file14a96726021b