The CSV question is like a media item, where you can use hosted data in your m-Path questionnaire. When the questionnaire reaches this item, the app fetches a CSV file from a URL you provide and makes its contents available to use in the rest of the questionnaire. A common use case is loading a personalised list of items or stimuli that can then be shown to the participant in a later question.
Configuration Fields
| Field | Type | Default | Description |
|---|---|---|---|
csvLocation | string | '' | Required. The hosted URL of the CSV file to download. |
delimiter | string | ',' | The character used to separate columns. Use ';' for semicolon-delimited files. Defaults to comma if not set. |
keepMedia | bool | true | Whether the downloaded CSV file is kept in local storage after the beep is completed, or deleted to save space. |
Expected CSV Format
The file must use a header row as the first row. Every subsequent row is treated as data.
product,calories,carbs
cheese,30,0.4
potatoes,10,17
chicken,8,0
- Header row: Column names (trimmed of whitespace). These become the
shortQuestionidentifiers used in piping. - Data rows: Values in the same column order as the headers.
- Quoted fields: Fields may be wrapped in double quotes (
"). A literal double-quote inside a quoted field must be escaped as"". - Empty cells: Missing values at the end of a row are treated as empty strings.
- Duplicate headers: If two columns share the same name, the second is automatically renamed
columnName_2, the thirdcolumnName_3, etc. - Empty column names: Unnamed columns are assigned the name
column, with the same de-duplication logic applied.
Using CSV Data in the Same Questionnaire
Once loaded, each column in the CSV becomes available to subsequent items in the questionnaire by its header name. Two common examples:
Computation: Reference a column by its header name to use its values in a formula or conditional logic. For example:
ages = age # age refers to the header age in our example
Dropdown: Set Drop down options label to the name of a CSV column and the dropdown will be populated with the values from that column.
Notes
- File caching: The CSV file is downloaded once and cached locally. If
keepMediaistrue, the file remains on the device between beeps, avoiding repeated downloads. - File updates: If you update the hosted CSV file, participants will only receive the new version after their cached copy is replaced. Setting
keepMediatofalseensures the latest version is always downloaded. - Large files: The entire file is read into memory during parsing. Very large files may cause a noticeable delay on the loading screen.