If you do not use R, see qualtricsbackupapp — a public, open-source web app that performs the same backup (QSF files, response CSV, metadata, question maps). The source code is public so you can verify that your API token is never stored.
This fork
- fixes the "Big Caveat: [...] report of the .qsf files the scripts creates not correctly importing into Qualtrics.".
- (also fixed other minor bugs that I noticed when running in my environment)
- Also added saving all files as .SAV SPSS files using the haven R package.
A very simple script for backing up all your data and .qsf files from Qualtrics. It will download all of the .qsf files and data for every survey in your account. It should be reasonably easy to use if you can use R. It works for me, but I definitely have not tested it with any other setup than my own. Please be careful whenever you are using an API- this script has no way to do anything but download your own data, but in theory you could mess things up.
This code uses the package qualtRics for downloading the data, and then uses httr for downloading the .qsf files, since that functionality wasn't in qualtRics. I wrote it pretty quickly, and it could definitely be improved on a lot of fronts (e.g. right now there is no code which accounts for a failure to download a .qsf file initially), but it works well enough that I figured it might be useful for someone else.
There are two versions of the script: qualtrics_backup.R, which I would recommend using first, and qualtrics_backup_compatibiltity_version.R, which you can use if you are having issues with your versions of packages not lining up with the ones used to write this code. They are identical, except that the compatibilty_version script loads the libraries differently using the groundhog package.
Go to user settings:
Get your datacenter ID (it will be something like ca1, yul1, etc) and your API key (it will be a long string). If you don't have an API key, hit Generate Token to get one.
Download the script in this repo, and put it into a new folder. Use RStudio to make that folder a new R project. At this point, this folder should look something like this example folder:
Then, go into the script and enter in your individual API key and datacenter URL on these two lines:
Then, run the whole script. It will first make subfolders to store your survey's data, metadata, question information, and .qsf files. Then it will go through and download all the qsf files, response data, and metadata/question info for each of your surveys.
Once you have run it, your folder will look like this:
If you look at the "qsf" folder, it is a bunch of .qsf files for your surveys, named using the survey name:
If you look at the "data" folder, it is the data for a bunch of your surveys, saved as .Rds files (R dataframes). They are named using the survey ID of each survey instead of the actual survey name:
To convert between the survey ID and the survey's name, there will be a .Rds file saved in your folder called "[DATE OF BACKUP]_surveybackup". It looks like this, and lets you convert between the name and ID.
The metadata folder has a bunch of .yaml files named by survey ID which have all the information about each question in them, though they are missing information about stuff like the survey flow which you can only get from the .qsf files.
The question_data folder has a bunch of essentially data dictionaries -- they are also named by survey ID, and list the name of Qualtrics questions as well as the question text itself.
One thing to check is that you are using a version of the packages consistent with the version that I used to write the script. The output of sessionInfo() for my version of each package is below. If your version of the package does not match, that could be what is causing the error. If you use the version of the R script qualtrics_backup_compatibility_version.R, that will use the package groundhog to ensure that your versions of the packages line up with the ones used when writing these scripts.
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rlist_0.4.6.2 qualtRics_3.2.0 here_1.0.1 fs_1.6.4 jsonlite_1.8.8 httr_1.4.7 lubridate_1.9.3
[8] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
[15] ggplot2_3.5.1 tidyverse_2.0.0 pacman_0.5.1
loaded via a namespace (and not attached):
[1] gtable_0.3.5 compiler_4.4.0 tidyselect_1.2.1 scales_1.3.0 R6_2.5.1 generics_0.1.3
[7] curl_5.2.1 sjlabelled_1.2.0 insight_0.19.11 rprojroot_2.0.4 munsell_0.5.1 pillar_1.9.0
[13] tzdb_0.4.0 rlang_1.1.3 utf8_1.2.4 stringi_1.8.4 timechange_0.3.0 cli_3.6.2
[19] withr_3.0.0 magrittr_2.0.3 grid_4.4.0 rstudioapi_0.16.0 hms_1.1.3 lifecycle_1.0.4
[25] vctrs_0.6.5 data.table_1.15.4 glue_1.7.0 rsconnect_1.3.0 fansi_1.0.6 colorspace_2.1-0
[31] tools_4.4.0 pkgconfig_2.0.3
- Not incremental. Every run re-downloads every survey in the account; there is no "only what changed since last time" mode.
- QSF downloads are not rate-limited or retried (
Sys.sleep(5)runs after each one, but a failedfetch_qsfcall is not retried). Response data and metadata (process_survey) are retried, up tomax_attempts = 5per survey, with the final pass/fail recorded insurvey_statusand printed at the end. .savexport truncates names and factor levels to meet SPSS limits (column names to 64 characters, factor levels to 50) viaclean_names()/save_to_spss()— long question texts or option labels will be shortened, and truncated names could collide (handled withmake.names(..., unique = TRUE), so collisions get a numeric suffix rather than silently overwriting each other).- Credentials are stored in plaintext in the script itself (
api_token,base_url) and again viaqualtrics_api_credentials(..., install = TRUE)in your R environment file. Do not commit the edited script with your token filled in. - Requires a specific
qualtRicsfork/ref (ropensci/qualtRics@0060364), not the CRAN release, because of a QSF-export bug in the upstream package (see the comment aboveremotes::install_github(...)in the script and the linked GitHub issue). - No SPSS export toggle —
.savfiles are always written alongside the.Rdsfiles; there is no flag to skip thehaven/SPSS step for accounts where it is not needed.
This is a small personal script shared as-is. Bug reports and small fixes (especially
anything affecting the .qsf export or the SPSS column/level truncation) are welcome via
GitHub issues or pull requests against
github.com/giladfeldman/qualtrics_backup.
There is no test suite; test a change against your own Qualtrics account before opening a PR.
No LICENSE file is committed in this fork or in the upstream whryan/qualtrics_backup it is based on, so this code defaults to all-rights-reserved. If you need to reuse it under an open license, open an issue to ask.
If this script contributes to your workflow, see CITATION.cff for citable
metadata.







