[Solved] How do I create a new row in google sheets?

Hi all!

It’s been a while.

Im trying to create a task app with google sheet.

But When using google sheet it doesn’t create a new row:
Here are the blocks:

The sheet is public for everyone to acces.

Thanks

1 Like

Does this work in Thunkable Live on a mobile device?

Can you share a link to the Google Sheet? Does the Google Sheet allow edit access or only view access?

2 Likes

No it doesn’t

Yes

I just checked and it seems All Okay

See this
image

The sheet
image

The blocks
image

Can you try again and and check that the Google sheet has the updates I made?

1 Like

Thanks @muneer it still doesn’t work:/
Here is the project link: Thunkable

The sheet is updated,
But nothing gets loaded in the app

1 Like

It’s crashing as soon as I try to type in the text input box.

Okay, if I tap the New Task button, nothing gets added to Google Sheets.

Edit: Task is a local data source, not a Google Sheet. You need to add the Google Sheet as a data source. Google Sheets have a green icon but yours does not:

Screen Shot 2022-03-27 at 11.37.30 AM

It is unfortunate that once you remix a project links to Data Sources are reset to Local. I tried my side and it’s working for me.

1 Like

Did you downloaded it and it Worked?
That’s odd.

1 Like

Let me explain more.

You cannot initialize a variable using Data Source blocks. So this
image
will result with a value of null which hinders your create row code from finishing.

This assignment must be done in Screen Opens block.
image

Hmmm that’s new for new for me.
Guess i’m never to old to learn something new😅
Anyways it’s working thanks!!

1 Like

I’m still learning… We’re all students in the school of life.

2 Likes

@Muneer, your question implied that YOUR blocks had somehow updated the google sheet of @lukehoogenboom0i - i was scratching my head wondering how you did that.
i’ve also verified that once you remix, the connection to the google sheet becomes a connection to local storage.
i have several questions about the use of google sheets in thunkable though.

  1. if my app connects to my google sheet - can i distribute it - as apk - and will the person who installs it also have access to the (only) version of my google sheet?
  2. do i have to mark my google sheet editable? (if the app creates a row)
  3. does this also work if it’s a webapp and i send the link to someone?
  4. how would it handle 2 users trying to add new (different) rows to my google sheet?
  5. or is google sheet useful mostly as a browsable object?

thanks

2 Likes

Hi @manyone
The first time I actually requested @lukehoogenboom0i to check, I made my own project and connected to his Google sheet because he made it available as a sharable resource.

The issue of converting the sheet to local table when remix, I have not went into more details in this subject, if you are a PRO member then you can share the project with an option to share your sources too.

Now, for your questions:

Yes, you can. You need to make your sheet sharable and editable for the APK to run as expected.

Yes, you need to.

Yes, it will/should work.

Thunkable does not manage multiuser tasks but in practice, if you do not have lots of concurrent users, then it should work but you will have to keep in mind the possibility of two users trying to commit data to the sheet simultaneously.

The sheet can manage edits but will not manage a situation like filtering data from one sheet to another while your app displays the filtered data because the other user will overwrite the content of the filtered sheet which would result in an unpredictable behavior.

Hope to have answered your queries.

1 Like

did you connect to his copy? how do you that? i also had a link to the google sheet but i couldnt figure out how to add a google sheet data source that points to a url.

or did you make a copy of the sheet and upload it to your google drive and connect to it as if it were yours?

2 Likes

thank you! you have answered all my questions!

1 Like

Yes.
You need to trick the system. First click on the link provided to view the sheet. Keep it open.
Now go to Thunkable and add the sheet as a new Data Source. You should see the sheet name in the list of available sheet after you click on the select sheet button.

However, I noticed that if I try to switch to the Blocks screen, I get nothing and had to close the project and open it again to be able to work normally.

The shared sheet has to be editable for the connection to work. If the sheet is read only then you will need to make a copy and work with the copy made.

2 Likes

that’s the option i didnt try! nice trick! if the app only reads the sheet , maybe you don’t need to set the sheet as editable.
for example i can share my jokes google sheet and a simple thunkable to read the sheet - anybody should be able to do your trick and make the app working? i want to try later.

2 Likes

Yes why not. I will be happy to try it.

1 Like

very nice of you.
here’s my jokes sheet (with permission to view only)

and here’s the joke_reader
https://x.thunkable.com/copy/5a5eb5fba6f380d9d1a9556a8ccbb109
it starts with a listviewer- click item to view the punchline.

thanks for testing.

2 Likes

I checked that and all works OK from both the computer and the mobile with one classic issue. In screen 2 you are showing the joke in a Label which supposed to scroll to see the rest of the joke. In the computer it scrolls, in the mobile it doesn’t.

2 Likes