# data.importConditions doesn't work on Pavlovia

**URL:** <https://discourse.psychopy.org/t/data-importconditions-doesnt-work-on-pavlovia/22058>\
**Category:** Online experiments\
**Tags:** pavlovia\
**Created:** [April 6, 2021, 6:20am UTC](https://discourse.psychopy.org/t/data-importconditions-doesnt-work-on-pavlovia/22058 "2021-04-06T06:20:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ladinboluk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/ladinboluk/32/15388_2.png) [@ladinboluk](https://discourse.psychopy.org/u/ladinboluk)\
**Post date:** [April 6, 2021, 6:20am UTC](https://discourse.psychopy.org/t/data-importconditions-doesnt-work-on-pavlovia/22058/1 "2021-04-06T06:20:31Z")

</div>

URL of experiment:

Description of the problem: [Pavlovia](https://pavlovia.org/ladinboluk/thesis)

I used “data.importConditions” to read from my files in Psychopy, but when I try to run it online I get the error data not defined. I have seen some solutions where they add some JS code to the beginning of the experiment, but it doesn’t work for me as I use this in 3 different places, and I generate the name of the file randomly in that routine.

To go into more detail, this is the JS code I am referring to:

```auto
myData = new TrialHandler({

psychoJS: psychoJS,

nReps: 1, method: TrialHandler.Method.SEQUENTIAL,

extraInfo: expInfo, originPath: undefined,

trialList: ‘conditions.xlsx’,

seed: undefined, name: ‘myData’});

```

However, I have various trialLists and the names of the files are not ‘conditions.xlsx’

This is my code:

```auto
primeCond = randint(0, 2)
fileName = str(primeCond) + 'list.xlsx'
primeList=data.importConditions(fileName)

```

Thanks!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 6, 2021, 6:57am UTC](https://discourse.psychopy.org/t/data-importconditions-doesnt-work-on-pavlovia/22058/2 "2021-04-06T06:57:26Z")

</div>

> [@ladinboluk](#):
>
> However, I have various trialLists and the names of the files are not ‘conditions.xlsx’

I think that the point of the JS code is that you should use it in full for each import, customising as necessary.

From my crib sheet:

**Python**

```auto
myData = data.TrialHandler(nReps=1, 
method='sequential', 
extraInfo=expInfo, 
originPath=-1, 
trialList=data.importConditions('conditions.xlsx'), 
seed=None, name='myData')

```

**JavaScript**

```auto
myData = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, 
method: TrialHandler.Method.SEQUENTIAL,
extraInfo: expInfo, originPath: undefined,
trialList: 'conditions.xlsx',
seed: undefined, name: 'myData'});

```

Access individual values using: aValue = myData.trialList[Idx][‘variableName’]
