View source: R/submission_export.R
submission_export | R Documentation |
submission_export(
local_dir = here::here(),
overwrite = TRUE,
media = TRUE,
repeats = TRUE,
deleted_fields = FALSE,
pid = get_default_pid(),
fid = get_default_fid(),
url = get_default_url(),
un = get_default_un(),
pw = get_default_pw(),
pp = get_default_pp(),
retries = get_retries(),
odkc_version = get_default_odkc_version(),
verbose = get_ru_verbose()
)
local_dir |
The local folder to save the downloaded files to,
default: |
overwrite |
Whether to overwrite previously downloaded zip files, default: FALSE |
media |
Whether to include media attachments, default: TRUE. This feature only has effect on ODK Central v1.1 and higher. Setting this feature to FALSE with an odkc_version < 1.1 and will display a verbose noop message, but still return all media attachments. |
repeats |
Whether to include repeat data (if TRUE), or whether
to return the root table only (FALSE). Default: TRUE.
Requesting |
deleted_fields |
Whether to restore all fields previously deleted from this form for this export (TRUE). All known fields and data for those fields will be merged and exported. default: FALSE |
pid |
The numeric ID of the project, e.g.: 2. Default: Set default See |
fid |
The alphanumeric form ID, e.g. "build_Spotlighting-0-8_1559885147". Default: Set default See |
url |
The ODK Central base URL without trailing slash. Default: Set default See |
un |
The ODK Central username (an email address).
Default: |
pw |
The ODK Central password.
Default: |
pp |
The passphrase for an encrypted form. Default: NULL. Passphrases can be stored e.g. as environment variables. See |
retries |
The number of attempts to retrieve a web resource. This parameter is given to Default: 3. |
odkc_version |
The ODK Central version as a semantic version string
(year.minor.patch), e.g. "2023.5.1". The version is shown on ODK Central's
version page Default: Set default See |
verbose |
Whether to display debug messages or not. Read |
This function exports all the Submission data associated with a Form as one zip file containing one or more CSV files, as well as all multimedia attachments associated with the included Submissions.
For an incremental download of a subset of submissions, use
submission_list
or odata_submission_get
with
filter queries.
The inclusion of subtables (from repeating form groups) can be toggled
through repeats
, whereas the inclusion of media attachments can be toggled
through media
.
The file will be downloaded to the project root unless specified otherwise
(via local_dir
). Subsequently, the zip file can be extracted.
Attachment filenames (e.g. "12345.jpg") should be prepended with media
(resulting in e.g. media/12345.jpg
) in order to represent the relative
path to the actual attachment file (as extracted from the zip file).
ODK Central supports two modes of encryption - learn about them
here.
ruODK
supports project managed encryption, however the support is limited
to exactly one encryption key. The supplied passphrase will be used against
the first returned encryption key. Remaining encryption keys are ignored by
ruODK
.
If an incorrect passphrase is given, the request is terminated immediately. It has been reported that multiple requests with incorrect passphrases can crash ODK Central.
The absolute path to the exported ZIP file named after the form ID.
The exported ZIP file will have the extension .zip
unless only the
root table was requested (with repeats=FALSE
), in which case the
exported file will have the extension .csv
.
In contrast to ODK Central, which exports to submissions.csv(.zip)
,
the exported ZIP file is named after
the form to avoid accidentally overwriting the ZIP export from
another form.
https://docs.getodk.org/central-api-submission-management/#exporting-form-submissions-to-csv
Other submission-management:
attachment_list()
,
encryption_key_list()
,
submission_audit_get()
,
submission_detail()
,
submission_get()
,
submission_list()
## Not run:
# See vignette("setup") for setup and authentication options
# ruODK::ru_setup(svc = "....svc", un = "me@email.com", pw = "...")
se <- submission_export()
# Unzip and inspect the loot
t <- tempdir()
f <- unzip(se, exdir = t)
fs::dir_ls(t)
fid <- get_test_fid()
sub <- fs::path(t, glue::glue("{fid}.csv")) %>% readr::read_csv()
sub %>% knitr::kable(.)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.