# Not getting .xlsx output

**URL:** <https://discourse.psychopy.org/t/not-getting-xlsx-output/37446>\
**Category:** Builder\
**Created:** [November 8, 2023, 7:29pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446 "2023-11-08T19:29:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 8, 2023, 7:29pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/1 "2023-11-08T19:29:53Z")

</div>

Hey everyone!

I am constructing a rating task (slider) with 288 trials. Everything works just fine except that I somehow cannot get a .xlsx output when I do not run the entire experiment (288 trials).

Does someone know how to change that? .xlsx files are the easiest to analyse with my statistical software (JASP), therefore this is an important issue for me.

I am very thankful for any help!  
-Severin

Code:

> **[experiment\_code\_severinm18](https://docs.google.com/document/d/18gyxQllKS3SdyhMj44TQUNXcmBACZ7J7oGjuFkkXrBY/edit?usp=sharing)**
>
> \#!/usr/bin/env python # -\*- coding: utf-8 -\*- """ This experiment was created using PsychoPy3 Experiment Builder (v2023.2.3), on November 06, 2023, at 20:55 If you publish work using this script the most relevant publication is: Peirce J,...

---

<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:** [November 9, 2023, 9:14am UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/2 "2023-11-09T09:14:23Z")

</div>

If you want to quit the experiment early you could have a key press that ends the loop (with code like trials.finished = True) so it exits cleanly instead of pressing excape.

---

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 9, 2023, 9:38am UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/3 "2023-11-09T09:38:38Z")

</div>

Hey wakecarter,

thank you for answering! That is a clever way of approaching the problem. Do you know at which section i would have to insert this code? Unfortunately (suprise), i am not familiar with coding yet.

Thanks again,  
-Severin

---

<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:** [November 9, 2023, 11:55am UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/4 "2023-11-09T11:55:18Z")

</div>

If you have a keyboard response called key\_resp then you could add ‘q’ as a valid key and then put

```auto
if key_resp.keys == 'q':
     trials.finished = True

```

This assumes your keyboard response is set to save a single key, not all keys. If all keys then you could use:

```auto
if 'q' in key_resp.keys:
     trials.finished = True

```

If the trial can end with no key pressed then you might need the following to avoid an error

```auto
if key_resp.keys:
     if 'q' in key_resp.keys:
          trials.finished = True

```

---

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 9, 2023, 3:32pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/5 "2023-11-09T15:32:39Z")

</div>

Hey wakecarter,

thank you! Do you know where in the code-string i would have to insert this command? As far as i am concerned it is not possible to command a loop to end inside the builder, because a loop does not have a “stop” condition like trials do (?). So i would need to insert this piece of code somewhere in the coder, right?

Thanks again,  
-Severin

---

<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:** [November 9, 2023, 3:42pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/6 "2023-11-09T15:42:55Z")

</div>

Put it in the trial routine in a code component in the End Routine tab (in Builder)

(I almost never use coder)

---

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 9, 2023, 4:10pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/7 "2023-11-09T16:10:17Z")

</div>

Dear wakecarter,

you are the man.

-Severin

---

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 9, 2023, 5:34pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/8 "2023-11-09T17:34:44Z")

</div>

[321\_BA\_Experiment\_2023-11-09\_18h09.33.804.csv](https://discourse.psychopy.org/uploads/short-url/9jD9EDPEqhhCdVOPyO9htVtUb4k.csv) (2.9 KB)

Dear wakecarter,

i guess it would have been too nice. If I run it offline, i am getting an xlsx file - perfect. If I run it online using credits i unfortunately do not get an xlsx file, just the usual csv file (which is very messy and therefore not attractive to further work with, you find one attached).

May I ask for your expertise once again? A way to get an ordered csv output would be a solution as well! Find also an ordered xlsx file attached.  
[665\_BA\_Experiment\_2023-11-09\_18h23.24.547.xlsx](https://discourse.psychopy.org/uploads/short-url/hy9ElAL219oRCcx9UWAEjHaogIB.xlsx) (14.8 KB)

Thank you once again  
-Severin

---

<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:** [November 9, 2023, 6:20pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/9 "2023-11-09T18:20:35Z")

</div>

Online the variables are created in the order of first use. Therefore you may be able to fool it into giving you the order you want by using thisExp.addData to add some empty data in your preferred columns in Begin Routine of the first routine.

---

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 9, 2023, 6:44pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/10 "2023-11-09T18:44:59Z")

</div>

Dear wakecarter,

I understand. So there is no way of getting different types of data into separated columns as an output from online experiments? If this is the only opportunity, i would again use a custom code, insert it in the very first routine and write a code in the “Begin Routine” section. I am afraid i dont know what kind of code you would insert here. I tried to understand it, with approaches like thisExp.addData.slider.rating, thisExp.add.slider.rating, thisExp.slider.rating .

None of this worked. Could you specify what kind of code you meant?

Thank you  
-Severin

---

<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:** [November 9, 2023, 6:49pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/11 "2023-11-09T18:49:22Z")

</div>

> [@severinm18](#):
>
> thisExp.addData.slider.rating

Try `thisExp.addData('slider.rating','')` etc.

Alternatively, if PsychoPy doesn’t like you saving that, then you could copy the data you want into custom columns that you’ve set to save first .

Column priority now works offline but won’t be online until next year

---

<div class="post-metadata">

**Author:** ![severinm18](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@severinm18](https://discourse.psychopy.org/u/severinm18)\
**Post date:** [November 9, 2023, 6:55pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/12 "2023-11-09T18:55:54Z")

</div>

It didn’t like it. Sorry for asking such questions, but how would I automatically transfer data to other columns?

---

<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:** [November 9, 2023, 7:33pm UTC](https://discourse.psychopy.org/t/not-getting-xlsx-output/37446/13 "2023-11-09T19:33:51Z")

</div>

```auto
Rating = slider.rating()
thisExp.addData('Rating', Rating)

```
