Not able to access data from Google Sheet in app

Hi,

I was helping out @e.fat4z3b with his query about creating a quiz app. Instead of hard coding questions in the app, I thought it best to use a datasource, so I created a Google sheet but could not get the data pulled into the app. The data shows up though when I click on the datasource. I then created a local datasource with the same information and can pull the data into the app.

Not sure what I am doing wrong.

Google Sheet Datasource, blocks and preview

Local Datasource, blocks and preview

Thanks
Steve

What happens if you assign a get value data source block to a label’s text and set the row id to 1 (using a math block)?

Are you able to see a cell value from the Google Sheet that way? If not, post a screenshot of that attempt.

That worked fine.

Okay so there’s not a problem with the way you set up or synced your Google Sheet.

The next steps would be to debug to figure out exactly where the problem is occurring. It could be how you’re setting the variable value for the row id (try a math block to set it to an integer instead) or an invalid property name (such as a column called “Answer1 “ with a space after it).

You can use my method of debugging if you like: Debugging in Thunkable X (Video)

Ok,

I hard set the row id to 1 and it worked. I then remembered that some people spoke about an issue with initialising variables with a value, so I initialised to blank and set the variable to 1 when the Welcome Screen button is clicked.

Very weird that this would affect Google Sheets and not the Local Datasource.

I seem to remember a problem with using data source blocks with the variable initialize block. So it might not be reading the correct value for the number of rows block there.

@matt_conroy Can you confirm (or not) that that’s something to avoid?

Yes, try to avoid initializing variables with a data source. Instead, start them as a blank string or empty list and then go ahead and set them to the data source at the appropriate point. Great callout, @tatiang.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.