Between-subjects counterbalancing using Pavlovia (assigning different .xlsx conditions files to different participants)

Thanks for the tip. For my experiment it’s easier if the allocation is sequential like in your first method. The reason why I ask is because I’d like to have 36 participants, 2 for each condition. So it should work then : participants 0-17 should get the same sequence as participants 18-35. I’ll do a test soon with a smaller amount of conditions.

Yes, that’s correct

I have just created 2 conditions Excel file to do a test, and I’ve implement the code in Before Experiment, but I’m unsure if and how to change the main loop in my experiment (usually one specific Excel file)

Is there something specific I should type in the “Conditions” line of my Loop in the Builder ?

Based on my code example above you would type $useFile

1 Like

I have got the following error, similarly to a previous poster here:

  • when importing condition: condition0.xlsx
  • when getting the value of resource: condition0.xlsx
  • unknown resource

The error replicates with condition1.xlsx

Do you know what is going wrong? Should I try copying files to html/resources? I don’t know what that means though. I have little experience with HTML.

PS: I have added you to my Gitlab directory if you want to have a look. It seems the 2 conditions files (0 and 1) are there.

You don’t have an html folder – which is good.

In PsychoPy go to Experiment Settings / Online and add the excel files as additional resources.

1 Like

Thanks so much, just went through a whole cycle and a bit, it seems to work smoothly ! Will try to do it with my 18 conditions soon.

Thanks so much for your time. This kind of distribution is really going to help. I guess this whole topic could be marked as solved

Hello @wakecarter ,

I’ve been trying to use a similar method locally so that the condition file selected in my experiment corresponds to the participant ID that’s manually entered at the start screen :

useFile = "condition"+str(expInfo['participant']%18)+".xlsx"

However, when I try to run the experiment locally I get the following error :

Traceback (most recent call last):
File “/Users/cameronmorin/PhD_experiments/Larne group (in-person and online/In-person experiment/”, line 96, in
useFile = “condition”+str(expInfo[‘participant’]%18)+".xlsx"
TypeError: not all arguments converted during string formatting

Is there something to change to make it work locally?

In my loop where I set the conditions to $useFile, I also get this message in the UI: no parameters set (conditionsFile not found)

All the best,



useFile = "condition"+str(int(expInfo['participant'])%18)+".xlsx"

JS is a bit more forgiving about switching types.

1 Like

Thank you, that seems to work ! I’ve another code problem but maybe I’ll write a separate post now.