# Problem import xlsx conditions file

**URL:** <https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635>\
**Category:** Other\
**Created:** [December 14, 2016, 12:37pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635 "2016-12-14T12:37:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noa\_Slater](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@Noa\_Slater](https://discourse.psychopy.org/u/Noa_Slater)\
**Post date:** [December 14, 2016, 12:37pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/1 "2016-12-14T12:37:25Z")

</div>

Hi,

I had an experiment with eye tracker (EyeLink, using PyGaze) which was run OK in PsychoPy 1.82.01.

I now migrated to version 1.84.2 and I encounter the following problems:

- In the experiment, a movie is shown. I can hear the movie but I get a black screen.
- I use a conditions xlsx file in a loop. I did not change anything in the file but at the end of the first iteration I get an error:

```auto
  File "D:\Rotem\pygaze-cocktail-pilot\CocktailPartyWithQuestionsWorkingAndBreakAddRandom.py", line 400, in <module>
    trialList=data.importConditions(questions_file),
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\data.py", line 2689, in importConditions
    _assertValidVarNames(fieldNames, fileName)
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\data.py", line 2601, in _assertValidVarNames
    raise ImportError(msg % fileName)
ImportError: Conditions file questions/04.xlsx: Missing parameter name(s); empty cell(s) in the first row?

```

Of course the first line is not empty.

What could cause this and how do I fix it ?

Thanks in advance!  
Noa

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [December 14, 2016, 2:37pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/2 "2016-12-14T14:37:41Z")

</div>

I don’t think it’s suggesting that the entire header row is empty but there is an empty cell in it. COuld you upload the xlsx file here for us to test?

---

<div class="post-metadata">

**Author:** ![Noa\_Slater](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@Noa\_Slater](https://discourse.psychopy.org/u/Noa_Slater)\
**Post date:** [December 15, 2016, 9:33am UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/3 "2016-12-15T09:33:52Z")

</div>

[02.xlsx](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/1X/971da2f2aeddca28d1c0e512694a68b603225c88.xlsx) (8.8 KB)

This is the file.

Again, in PsychoPy 1.82.01 it is working well (I have each version installed on a different computer)

Also, do you have any suggestion what could be the problem with the movie display?

Thanks !!  
Noa

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/richard/32/6389_2.png) [@richard](https://discourse.psychopy.org/u/richard)\
**Post date:** [December 15, 2016, 10:15am UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/4 "2016-12-15T10:15:23Z")

</div>

The file is saved in a right-to-left manner (Hebrew or such??), which the simple `importConditions` function cannot handle. pandas however is able to load the file just fine.

We should definitely switch `importConditions` to use pandas.

Do you use the Coder or the Builder?

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [December 15, 2016, 1:08pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/5 "2016-12-15T13:08:48Z")

</div>

That might help, but the other problem (which may be caused by the right-to-left aspect), is that the xlsx file does seem to be encoded with some extra columns of nothing. To me it looks like some application has added some empty columns to you file for no good reason. If I save the file as a csv file instead and then open it in a text editor it looks like this:

```auto
question,correct_response,,,,,,,,,,,
questions\02\Slide4.JPG,3,,,,,,,,,,,
questions\02\Slide5.JPG,1,,,,,,,,,,,
questions\02\Slide6.JPG,2,,,,,,,,,,,
questions\02\Slide7.JPG,3,,,,,,,,,,,

```

I was able to fix the import by copying the genuine data to a new file and saving it again. [02b.xlsx](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/1X/04c1965f2312094fe421141ac0696bc23c954ad0.xlsx) (25.5 KB)

I’m afraid that PsychoPy isn’t smart yet about working out whether blanks in a file could be safely ignored (as in this case) or whether they are a problem.

Out of interest, what was the file created in Noa?

---

<div class="post-metadata">

**Author:** ![Noa\_Slater](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@Noa\_Slater](https://discourse.psychopy.org/u/Noa_Slater)\
**Post date:** [December 17, 2016, 8:33pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/6 "2016-12-17T20:33:11Z")

</div>

The file was generated in Excel and PsychoPy 1.82.01 was OK with the exact same file.  
However, I did try a small testcase to test the xlsfile on a new simple “experiment” and found that if I just copy the relevant cells to a new excel file it worked. I will proceed to check that on my original experiment.

If this is fixed then I just have the problem with the movie, why it is not displayed although it is heard, while a simple picture is shown before. Again, in 1.82.01 it did work fine.  
What are the major changes regarding display sine 1.82.01 version?

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [December 18, 2016, 8:54pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/7 "2016-12-18T20:54:00Z")

</div>

I don’t know why the movie isn’t working - I’m not aware of anything changing or any bugs around this that cropped up recently. Very hard to know what might have caused it from the little info here. Is this an issue with all movies? Which backend are you using (MovieStim, MovieStim2/opencv or Moviestim3/pymovie)? Could you show us the params of your stimulus?

---

<div class="post-metadata">

**Author:** ![Treva\_Kennedy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/treva_kennedy/32/2599_2.png) [@Treva\_Kennedy](https://discourse.psychopy.org/u/Treva_Kennedy)\
**Post date:** [June 19, 2018, 11:28pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/8 "2018-06-19T23:28:22Z")

</div>

Thanks Jon, this answer was helpful for me too! I was having a similar problem. It turned out, I had a default header, “Table 1” in my excel that I guess psychopy didn’t understand.

---

<div class="post-metadata">

**Author:** ![xe08maxu](https://avatars.discourse-cdn.com/v4/letter/x/f14d63/32.png) [@xe08maxu](https://discourse.psychopy.org/u/xe08maxu)\
**Post date:** [October 23, 2018, 9:23pm UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/9 "2018-10-23T21:23:44Z")

</div>

Hi everyone,

I am dealing with even a simpler problem. I wanted to create a strooper test, and I cannot import a simple xlsx file. Psychopy either doesn’t recognise it.

Thank you for your help in advance.

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [October 24, 2018, 2:42am UTC](https://discourse.psychopy.org/t/problem-import-xlsx-conditions-file/1635/10 "2018-10-24T02:42:20Z")

</div>

There is not sufficient information here to give an answer. As suggested elsewhere to you by @Jin_Jeon:

- please make your own topic rather than add to an existing one, and
- actually provide the level of detail needed. e.g. Paste in the text of any error messages. “Psychopy either doesn’t recognise it.” doesn’t mean anything useful to us.
