# \[Solved\] Unable to iterate through spreadsheet

**URL:** <https://community.thunkable.com/t/solved-unable-to-iterate-through-spreadsheet/2765998>\
**Category:** Questions about Thunkable X\
**Created:** [January 2, 2024, 9:19pm UTC](https://community.thunkable.com/t/solved-unable-to-iterate-through-spreadsheet/2765998 "2024-01-02T21:19:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve\_synopsis](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@steve\_synopsis](https://community.thunkable.com/u/steve_synopsis)\
**Post date:** [January 2, 2024, 9:19pm UTC](https://community.thunkable.com/t/solved-unable-to-iterate-through-spreadsheet/2765998/1 "2024-01-02T21:19:00Z")

</div>

Hi,

I have a Google sheet in my data source which has 2 columns - number and name. I can iterate through the number column fine but when I change the column to the name one, I cannot.

I am using the same code; just changing the column name and the property from “number” to “name”. The list is pulled and displayed but the iteration does not work.

[https://x.thunkable.com/copy/ef3089587e4a5f96dd10da54fee0179c](https://x.thunkable.com/copy/ef3089587e4a5f96dd10da54fee0179c)

 ![2024-01-02 17 15 32](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/41e9b25f9154ebfbbe3ca5d3be98577bc433b93f.png)

Has me stumped.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 3, 2024, 1:25am UTC](https://community.thunkable.com/t/solved-unable-to-iterate-through-spreadsheet/2765998/3 "2024-01-03T01:25:49Z")

</div>

The problem is that when you loop through a list using a variable (in this case k), the value of the variable is the data source **value** in that row and column. So as you loop through the “number” column, you’re attempting to get the value from row “1” and then row “2” and then row “3”. It’s just a happy coincidence that that worked. If you changed the values in the “number” column to something else like “one” or “blah”, it would fail.

But when you loop through the “name” column, you’re attempting to get the value from row “Luna Lewis”… and since that’s not a number, Thunkable doesn’t know what to do with it.

You need to use a variable to store the loop index or you need to use a for loop that counts from 1 to the number of rows in the data source. And then use that numeric value as your row id.

---

<div class="post-metadata">

**Author:** ![steve\_synopsis](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@steve\_synopsis](https://community.thunkable.com/u/steve_synopsis)\
**Post date:** [January 4, 2024, 3:49pm UTC](https://community.thunkable.com/t/solved-unable-to-iterate-through-spreadsheet/2765998/4 "2024-01-04T15:49:19Z")

</div>

Gotcha, thanks

---

<div class="post-metadata">

**Author:** ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)\
**Post date:** [January 4, 2024, 3:54pm UTC](https://community.thunkable.com/t/solved-unable-to-iterate-through-spreadsheet/2765998/5 "2024-01-04T15:54:12Z")

</div>


