Sequential randomization of stimuli and different versions of them

Hello,

I am aware that there are several topics similar to the one I am posting here, but none seems to be close enough to what I want to do.

I have 8 stimuli (1 to 8) and 4 versions of them (a to d), which makes up a total of 32 stimuli.
I want each block to run all those 32 trials with these restrictions.
Trials 1 to 8: stimuli 1 to 8 are presented in random order. The version is also determined randomly among the 4 possibilities. E.g., this first 8 trials could be… 6a, 1d, 2d, 8d, 7c, 4b, 5a, 3c.
Trials 9 to 16: stimuli 1 to 8 are presented in random order. This time, a different randomly chosen version of them is used. E.g., 5c, 2c, 8a, 3a, 4c, 1b, 6c, 7d.
Trials 17 to 24: 1 to 8 in random order with a different version.
Trials 25 to 32: 1 to 8 in random order with the version that is left.

I have thought of using two excel files: excel file “Stimuli” would contain the parameters that define each of the 8 stimuli and that are common to all versions. and excel file “version” would define the parameters that establish the different versions. but I don’t see how I should organize those two excel files to get what I want.

Any help would be appreciated,

Best!

Paula.