Export specific data elements in Excel
Conjointly allows you to export all data at once or export specific data elements individually. This is useful when you only need specific sheets, such as quality risk signals or respondent locations.
Here is how to use R to export specific elements from your experiment as an Excel file.
The example below exports the Respondent Information and Quality risk signals sheets.
CONJOINTLY_TOKEN <- "YOUR_TOKEN" # Get a token from https://run.conjoint.ly/utilities/tokens
formulateElements <- function() {
elements <- list(
type = "excel",
numberFormatPreference = TRUE,
colnameFormat = "one_row",
elements = list(
list(type = "special-entity", payload = list(what = "respondent-info", mode = "simplified")),
list(type = "special-entity", payload = list(what = "data-dumps-quality-risk-signals"))
))
return(elements)
}
downloadExport <- function(
experiment_id,
overwrite = FALSE,
filename = "data.xlsx",
elements = formulateElements(),
TOKEN = CONJOINTLY_TOKEN
) {
library(httr)
library(jsonlite)
headers <- add_headers(
`Authorization` = paste("Bearer", TOKEN),
`Content-Type` = "application/json",
`Accept` = "application/json",
`X-Requested-With` = "XMLHttpRequest"
)
cat('Requesting export of data...\n')
exportRequest <- POST(
paste0("https://api.conjoint.ly/api/experiments/", experiment_id, "/export/element"),
headers,
body = toJSON(elements, auto_unbox = T)
) |> content("parsed", encoding = "UTF-8")
# Make sure the export is completed:
repeat {
if (exportRequest$data$status %in% c('completed', 'done')) {
break;
}
Sys.sleep(2)
cat('Checking if file is ready...\n')
exportRequest <- GET(
paste0("https://api.conjoint.ly/api/jobs/", exportRequest$data$id, "/get"),
headers
) |> content("parsed", encoding = "UTF-8")
}
cat('Finding the location of the file on AWS...\n')
intermediateFilename <- exportRequest$data$response$uri
awsFileLocationRequest <- GET(
intermediateFilename,
headers
)
cat('Downloading the file from AWS...\n')
GET(
awsFileLocationRequest$url,
write_disk(filename, overwrite = overwrite)
)
return(awsFileLocationRequest$url)
}
downloadExport(experiment_id, overwrite = TRUE)
To customise your export, add or remove items in the elements list inside formulateElements(), and update the what = value with the element you wish to export. Note that only respondent-info accepts an additional mode parameter ("simplified" or "full").
Available elements
respondent-info- Optional
mode:"simplified"or"full"
- Optional
conjoint-dataconjoint-ranked-conceptsinteractive-simulatordata-dumpsdata-dumps-crosstabdata-dumps-questionsdata-dumps-items-of-questionsdata-dumps-stimuli-in-monadic-blocksdata-dumps-answers-to-questionsdata-dumps-answers-to-questions-itemsdata-dumps-owbdata-dumps-twbdata-dumps-twb-weightsdata-dumps-bowbdata-dumps-cbohdata-dumps-cboh-weightsdata-dumps-quality-risk-signalsdata-dumps-respondents-locationsdata-dumps-text-highlights-rawdata-dumps-text-highlights-tabulateddata-dumps-image-heatmap-dotsdata-dumps-image-heatmap-brushesdata-dumps-segment-membershipdata-dumps-design-matrixdata-dumps-model-matrixdata-dumps-raw-responsesdata-dumps-conversational-survey-answers
Caching behaviour
The export-excel-element data element is cached.
Results are stored after the first generation, and subsequent calls with the same parameters return the previously generated file until the cache is invalidated. To obtain fresh data reflecting new respondents or updated experiment settings, reset the report before re-requesting the export.
For a reusable R example, see Reset and regenerate a report.