Selecting rows in an Excel sheet within a loop?

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): 11 Home
PsychoPy version (e.g. 2025.1.1):
Standard Standalone Installation? (y/n) y If not then what?:
Do you want it to also run online? (y/n) y
What are you trying to achieve?:

I am using builder view and I am trying to use only a subset of rows from the excel sheet. The rows are defined by statusGroup (which is either 0 and 1). This needs to be connected with the previously defined variable counterbalance.group (with values 0 and 1) that is made through the counterbalance routine. Basically, I only need to run the rows that have the same value as the counterbalance.group.

What did you try to make it work?:

I tried filtering it using select rows but that was not working with code. I also tried making manual code before the loop, as well as within, but that did not work.

Link to the most relevant existing thread you have found:

However, this thread does not take into account my main issue - which is to only select rows of a specific value for a variable.

Hello @lucy_s

why would


if statusGroup == 0:
    useRows = '2:5'
elif statusGroup == 1:
    useRows = '6:9'

not work? You need to organise your condition file accordingly.

What approach have you taken so far?

Best wishes Jens

I figured it out - but thank you!