[Solved] Unable to iterate through spreadsheet

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

Has me stumped.

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.

Gotcha, thanks