How to load conditions from Excel in PsychoJS ? (unknown resource)

Description of the problem:

I have some trouble importing an excel sheet to determine my conditions.
I’ve checked, and the cursor is in within my data, and the excel sheet is correctly downloaded in html/resources.

However, I get the following error message :

"Unfortunately we encountered the following error:

  • when importing condition: stimuli.xlsx
  • when getting the value of resource: stimuli.xlsx
  • unknown resource
    Try to run the experiment again. If the error persists, contact the experiment designer."

I’m using the following trial handler :

  trials = new TrialHandler({
    psychoJS: psychoJS,
    nReps: 3, method: TrialHandler.Method.RANDOM,
    extraInfo: expInfo, originPath: undefined,
    trialList: 'stimuli.xlsx',
    seed: undefined, name: 'trials'

My excel files are the following : stimuli.xlsx (9.8 KB)
and practice.xlsx (8.9 KB)

I’ve tried to load excel sheets that have worked in other experiments but it just does not work.

What could be done to resolve this?

Thank you for your help !

Call it something other than trials

I just tried your solution but I still get the same error message.

I’ve decided to recreate another experiment from scratch, including ONLY an excel import and I keep getting the same error.


Sorry - when I said don’t use trials, I assumed you were showing me a code component.

Are you trying to load the Excel using code or using a Builder loop? If the answer is both then that will be the problem.

I have tried to do it with code, it did not work , then tried with with the builder not both at the same time.

However , I think the problem is the loading of the resources :
When i force them to load , my experiment works .
I’m using the following code :

  expName: expName,
  expInfo: expInfo,
   resources: [
    { name: 'practice.xlsx', path: './resources/practice.xlsx' }

The big problem being that each time i modify my code for any other reason and resubmit it, this portion gets replaced by the default code.

Have you put practice.xlsx in html/resources locally and then resynced? You shouldn’t need to name the path if you have.

Yes I did, with no convincing results :confused:

I’m having the same problem you expose here. I was wondering if you managed to solve it, and if so how? I don’t find an answer in this threat. Thanks

Hi there!
Yes I have managed to find a solution :slight_smile:

Instead of using excel for my conditions, I created a table directly in the experiment, with the javascript tool

Having the conditions on a excel sheet seemed like a very unstable method, since it did work on some tasks, but not others.
I would recomment to use javascript all the time to create condition tables, it seems more reliable as I never had problems with this method.

Hope it’ll work fine for you!


I’m currently running into the same problem. Could you maybe elaborate a bit on what you did (i.e. how you created the table in the experiment and with which javascript tool)?

Kind regards!