| Reference | Downloads | Github

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: