There are two methods for working with Excel documents in the attached link:
You can use the first code I posted in that link, which is a custom function for reading xlsx/csv. Alternatively, you can use the TrialHandler code for reading xlsx/csv files. The rest of the code would look something like:
// four categories of stimuli
cate1 = [];
cate2 = [];
cate3 = [];
cate4 = [];
// images are displayed on left or right of screen
leftImages = [];
rightImages = [];
// read the stimuli from excel sheet
threshhold = Math.round(numItems / numCates);
for (let rowx of [...Array(numItems).keys()]) {
// read in the row
row = NEW_JS_OBJECT_CONTAINING_DATA(rowx) // This will be your conditions file
// save image filepath to appropriate list
// images must be grouped in a single column
// in category order to work
if (rowx < threshhold) {
cate1.push(row[0])
} else if (rowx < threshhold * 2) {
cate2.push(row[0])
} else if (rowx < threshhold * 3) {
cate3.push(row[0])
} else {
cate4.push(row[0])
}
}