How to sync tinydb data to google sheets?

I can send a single entry in the app to google sheets. I can save multiple entries in tinydb. But I don’t know how to send all saved data to google sheets.

blocks

blocks(2)

You cannot do like this… It show no rhythm in the logic. To send data to Google sheet especially using form response, you should send one by one…you must try with clock component.

So first get length of the list stored in tinydb.

Then use clock component to store one by one at particular interval of time . Simple .

I have tried this method, and got succeed…

image

2 Likes

I’m going to try this implementation right now and thank you in advance.

The SCript code is


function doGet(e) { 

  var ss = SpreadsheetApp.openById("YOUR_GSHEET_ID"); 
  var sh = ss.getSheetByName("Your_Sheet_Name"); 

  var ID = e.parameter.ID ; 
  var NAME = e.parameter.NAME ;
  var EMAIL = e.parameter.EMAIL ;
  var PHONE = e.parameter.PHONE ;

  sh.appendRow([ID,NAME,EMAIL,PHONE]);
  return ContentService.createTextOutput("Success" );

}
1 Like

I just tested the code and it worked beautifully.
Thank you very much for this precious information.
I need to study more, I’ve been thinking about the solution for a few days and nothing looks like the solution you made.
Thank you again.

1 Like

Regarding the usage of gsheet in kodular there are numerous idea were given by @TimAi2 in his website

I always use to find whatever I want. Keep watching his guide or search in our community…

1 Like

I tried adding a ListView and implementing a long click of this listView to remove the entry. I had already done this code before in another project, but now it is not working anymore.
What am I doing wrong?

blocks(5)

blocks(4)

Earlier you may have cleared based on Tag but not you are not use tag… because everytime while saving data in tinydb you are saving the data in same tag

As per your first query, Did you able to synchronise between tinydb and gsheet or not using the above script?

I’m syncing tinybd with google sheets using the script you provided. It’s working.

1 Like

Only this increment of the long Click on the ListView that is not working.

Captura de tela 2022-12-01 173043

What did you add in the long click event

To remove a wrong entry.

You must add logic… in list view how do you get data? Only last saved item or all the items

In the long click block, I initialized a counter that informs which item in the list I clicked, but when selecting the saved item from Tinybd it says that the list only has 1 lenght. How can I report the correct item?

blocks(4)

Before this event tribger what you will see in the list view? Last saved item or all the items? Pls show in screenshot

I will see all items. This way, I can analyze if they are all right and decide if I need to exclude any of them.

you must remove the selected item using index …

call the tinydb in a variable, from this variable remove the selected index

then save once again the removed item into tinydb

I tried like this and found working good

image

1 Like

I’ll try it right now.