1. What is the issue? Please be detailed.
I am seeking to include images in my form based on a list in a csv. This is in the hope of being able to update the csv and upload the relevant media to Central if/when that list of images changes. This would be instead of having to include the list of images / filenames in the choices sheet (using the 'image' column). I've already fallen over with 'special columns' so maybe I'm making a similar mistake.
I asked KAPA the following question and very confidently it came up with the answer below:
how can I include image choices from csv to display in the form with the images being stored in the media folder Okay, not the most eloquent of questions, I'm not very familiar with AI... But KAPA says:
You can do this with an external CSV and the image column in the choices sheet.
- In your external CSV
Add a column that contains the image filenames (e.g. img_file):
name,label,img_file
a,Option A,a.jpg
b,Option B,b.jpg
c,Option C,c.jpg
Put the actual image files (a.jpg, b.jpg, c.jpg, …) in the form’s media folder (e.g. myform-media/ in Collect, or upload them as media attachments in Central). [Form styling]
2. In your XLSForm – choices sheet
In the image column, put the CSV column name that holds the filenames (not the filenames themselves):
choices
| list_name | name | label | image |
|---|---|---|---|
| mylist | a | A | img_file |
| mylist | b | B | img_file |
| mylist | c | C | img_file |
This tells ODK to pull the image filename from the img_file column in the CSV for each choice. [Dynamic media from CSV; Video in choice list from CSV]
3. In your XLSForm – survey sheet
Use a select question that draws from that list (and uses the CSV via search() or select_one_from_file, as you already do):
survey
| type | name | label | appearance |
|---|---|---|---|
| select_one mylist | my_choice | Select an option |
As long as:
the CSV is correctly referenced (e.g. via search() / select_one_from_file), and
all image files named in the CSV are present in the form’s media folder / uploaded as media,
the choices will display with images pulled from the CSV. [Including media in choices]
2. What steps can we take to reproduce this issue?
I tried to follow the answer and created a form (I only picked the top 3 images to put in the choices sheet)
ImagesFromCSV.xlsx (106.5 KB)
and imagelist.csv
imagelist.csv (909 Bytes)
How can I upload the images in the image list? - Central doesn't recognise the images when I try to drag them to the draft form (see screenshot). Maybe I'm doing something fundamentally stupid (wouldn't be the first time!) but I thought I was following KAPA. If it is suggesting that we need to essentially duplicate the lists, but not include the filename in the choices sheet I'm not sure I see the advantage - and it doesn't appear to work. And it's not what I'm hoping to do. Maybe it is 'logical' in that the xml needs to include every option within the choices sheet, and the external CSV doesn't get processed by Central to generate the options?
3. What have you tried to fix the issue?
Have a look at the form...
I can 'fix' this by putting the imagelist in the choices sheet - Central then asks for all the files, but that defeats my purpose as I need to update the form definition. I know I can do that using excel formulae but I was looking for another way that doesn't require the xlsx to be updated and resubmitted to Central...
4. Upload any forms or screenshots you can share publicly below.



