# How to load a csv/xlsx. from code?

**URL:** <https://discourse.psychopy.org/t/how-to-load-a-csv-xlsx-from-code/40466>\
**Category:** Builder\
**Created:** [June 18, 2024, 11:03am UTC](https://discourse.psychopy.org/t/how-to-load-a-csv-xlsx-from-code/40466 "2024-06-18T11:03:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EatMoreArt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/eatmoreart/32/42049_2.png) [@EatMoreArt](https://discourse.psychopy.org/u/EatMoreArt)\
**Post date:** [June 18, 2024, 11:03am UTC](https://discourse.psychopy.org/t/how-to-load-a-csv-xlsx-from-code/40466/1 "2024-06-18T11:03:23Z")

</div>

Hey,

i am struggeling with my experiment. I try to present two numbers and the participant has to decide which one is bigger. The condition file has 216 pairs, but in the practice part i just want some random air not all of them. So thats why I dont use the loop to set the condition. Is there a way to load the condition in the practice part by using a code component?

---

<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:** [June 18, 2024, 10:59pm UTC](https://discourse.psychopy.org/t/how-to-load-a-csv-xlsx-from-code/40466/2 "2024-06-18T22:59:16Z")

</div>

Yes. There are some examples on the PsychoPy online demos thread.

However, you could also just break of of the loop early.

```auto
if trials_orac.thisN == 9:
     trials_prac.finished = True

```
