{"id":15475,"date":"2026-04-21T08:50:55","date_gmt":"2026-04-21T08:50:55","guid":{"rendered":"https:\/\/manual.m-path.io\/?post_type=ht_kb&#038;p=15475"},"modified":"2026-04-21T08:54:17","modified_gmt":"2026-04-21T08:54:17","slug":"csv-question-item","status":"publish","type":"ht_kb","link":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/knowledge-base\/csv-question-item\/","title":{"rendered":"CSV Question Item"},"content":{"rendered":"\n<p>The CSV question is like a media item, where you can use <a href=\"https:\/\/manual.m-path.io\/knowledge-base\/file-hosting\/\" data-type=\"ht_kb\" data-id=\"15545\">hosted<\/a> 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.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon\">Learn more about hosting your own files to use in m-Path <a href=\"https:\/\/manual.m-path.io\/knowledge-base\/file-hosting\/\" data-type=\"ht_kb\" data-id=\"15545\">here<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-configuration-fields\">Configuration Fields<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Field<\/th><th>Type<\/th><th>Default<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>csvLocation<\/code><\/td><td>string<\/td><td><code>''<\/code><\/td><td><strong>Required.<\/strong>&nbsp;The hosted URL of the CSV file to download.<\/td><\/tr><tr><td><code>delimiter<\/code><\/td><td>string<\/td><td><code>','<\/code><\/td><td>The character used to separate columns. Use&nbsp;<code>';'<\/code>&nbsp;for semicolon-delimited files. Defaults to comma if not set.<\/td><\/tr><tr><td><code>keepMedia<\/code><\/td><td>bool<\/td><td><code>true<\/code><\/td><td>Whether the downloaded CSV file is kept in local storage after the beep is completed, or deleted to save space.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-expected-csv-format\">Expected CSV Format<\/h2>\n\n\n\n<p id=\"example\">The file must use a&nbsp;<strong>header row<\/strong>&nbsp;as the first row. Every subsequent row is treated as data.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">product,calories,carbs<br>cheese,30,0.4<br>potatoes,10,17<br>chicken,8,0<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Header row:<\/strong>&nbsp;Column names (trimmed of whitespace). These become the&nbsp;<code>shortQuestion<\/code>&nbsp;identifiers used in piping.<\/li>\n\n\n\n<li><strong>Data rows:<\/strong>&nbsp;Values in the same column order as the headers.<\/li>\n\n\n\n<li><strong>Quoted fields:<\/strong>&nbsp;Fields may be wrapped in double quotes (<code>\"<\/code>). A literal double-quote inside a quoted field must be escaped as&nbsp;<code>\"\"<\/code>.<\/li>\n\n\n\n<li><strong>Empty cells:<\/strong>&nbsp;Missing values at the end of a row are treated as empty strings.<\/li>\n\n\n\n<li><strong>Duplicate headers:<\/strong>&nbsp;If two columns share the same name, the second is automatically renamed&nbsp;<code>columnName_2<\/code>, the third&nbsp;<code>columnName_3<\/code>, etc.<\/li>\n\n\n\n<li><strong>Empty column names:<\/strong>&nbsp;Unnamed columns are assigned the name&nbsp;<code>column<\/code>, with the same de-duplication logic applied.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-using-csv-data-in-the-same-questionnaire\">Using CSV Data in the Same Questionnaire<\/h2>\n\n\n\n<p>Once loaded, each column in the CSV becomes available to subsequent items in the questionnaire by its header name. Two common examples:<\/p>\n\n\n\n<p><strong>Computation:<\/strong>&nbsp;Reference a column by its header name to use its values in a formula or conditional logic. For example: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ages = age # age refers to the header age in our <a href=\"#example\">example<\/a><\/code><\/pre>\n\n\n\n<p><strong>Dropdown:<\/strong>&nbsp;Set&nbsp;<code>Drop down options label<\/code>&nbsp;to the name of a CSV column and the dropdown will be populated with the values from that column.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-researcher-notes\">Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>File caching:<\/strong>&nbsp;The CSV file is downloaded once and cached locally. If&nbsp;<code>keepMedia<\/code>&nbsp;is&nbsp;<code>true<\/code>, the file remains on the device between beeps, avoiding repeated downloads.<\/li>\n\n\n\n<li><strong>File updates:<\/strong>&nbsp;If you update the hosted CSV file, participants will only receive the new version after their cached copy is replaced. Setting&nbsp;<code>keepMedia<\/code>&nbsp;to&nbsp;<code>false<\/code>&nbsp;ensures the latest version is always downloaded.<\/li>\n\n\n\n<li><strong>Large files:<\/strong>&nbsp;The entire file is read into memory during parsing. Very large files may cause a noticeable delay on the loading screen.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":6,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[],"ht-kb-tag":[],"class_list":["post-15475","ht_kb","type-ht_kb","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/ht-kb\/15475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/comments?post=15475"}],"version-history":[{"count":6,"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/ht-kb\/15475\/revisions"}],"predecessor-version":[{"id":15587,"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/ht-kb\/15475\/revisions\/15587"}],"wp:attachment":[{"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/media?parent=15475"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/ht-kb-category?post=15475"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/app-manual-wp-001-atfsdabuggg7fzdq.germanywestcentral-01.azurewebsites.net\/wp-json\/wp\/v2\/ht-kb-tag?post=15475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}