Share My Creation READ, ADD, UPDATE, AND DELETE DATA FROM GOOGLE SHEETS USING API V4

This project has all the necessary connections to communicate with a google needs the Google OAuth2 class:

*Important talk in your project the google sheets app from google console developers

Also uses the Tasty Toast library:

It cost me a lot of work to develop all the necessary connections and I also have some economic problems now, so if someone is interested in acquiring the source code is the sale for 40 dollars, only payments via PayPal, send the receipt once the payment is made to the mail [email protected]

paypal: [email protected]
Cost: $40 US


link of the app:

The link on the sheet where you can review the changes made by the app is as follows:
Google sheets api example
 

Attachments

  • 1645900688423.png
    1645900688423.png
    240.7 KB · Views: 2,811
  • 1645900647227.png
    1645900647227.png
    211.5 KB · Views: 294
  • 1645900603853.png
    1645900603853.png
    221.5 KB · Views: 272
  • 1645900546637.png
    1645900546637.png
    225.9 KB · Views: 280
  • 1645900489920.png
    1645900489920.png
    197.5 KB · Views: 296
  • 1645900440662.png
    1645900440662.png
    209.7 KB · Views: 278
  • 1645900392393.png
    1645900392393.png
    145 KB · Views: 240
  • 1645900359806.png
    1645900359806.png
    200.4 KB · Views: 262
  • 1645900293643.png
    1645900293643.png
    329.4 KB · Views: 267
  • 1645900227855.png
    1645900227855.png
    162.9 KB · Views: 242
  • 1645900083509.png
    1645900083509.png
    212.5 KB · Views: 266
Last edited:

SimonAndroid

Active Member
Licensed User
Longtime User
Would a question be possible to delete the rows using a checkbox or by selecting the line, without typing the ID number?
 

fernando1987

Active Member
Licensed User
If possible, the id data does not need to be known can be obtained and saved in a variable of type string. as if it were a database in the documentation the api needs to update and delete the exact number of the row that data I obtain by placing this formula in the first row in the final column:
"=ARRAYFORMULA(if(A1:A<>""; ROW(A1:A);""))"
So I get the column number only if you write a new data in column A and this is automatically ase once obtained you can associate it with any other field if the behavior is like the main key of a database. many things can be done, for example if it is modified it can be deleted by range from one id to another. In a simple way it can be used as a database in any app. There are no limits to the possibilities
 

Xfood

Expert
Licensed User
congratulations, it is an excellent tools, I think that if you make a lower economic offer, you will surely have more people willing to buy it.
 

fernando1987

Active Member
Licensed User
Dear, I propose the following I will not sell the source code instead and in a cheaper way I will develop two b4xlib libraries, the first library is called GSheets with a cost of 25 US (Much cheaper than paying an API) that allows Update, Delete and add.

The second library called GSheetsplus with a cost of 30 US will allow, apart from the options of the first one, to work with extra options such as spreadsheet creation, creation of sheets within a spreadsheet, deleting sheets among other extra options that will be added.

As the subject of reading is a little more complicated, because of the fact that the API does not let you search or filter by a certain data or name I make available to everyone my website https://gsheets2json.xyz/ where I develop a free app that allows you to communicate in a more fluid way with Google sheets.
 

Xfood

Expert
Licensed User
hello, I don't think it's a good idea, maybe have the plus l8breria ok, but complete with source code, and complete with api, without using third-party apps, at an affordable price, and you will see that here many will make the purchase, if instead you want to tie silo shoppers with third party library and apps, I know your sales policy won't be very successful. This is my thought
 

fernando1987

Active Member
Licensed User
hello, I don't think it's a good idea, maybe have the plus l8breria ok, but complete with source code, and complete with api, without using third-party apps, at an affordable price, and you will see that here many will make the purchase, if instead you want to tie silo shoppers with third party library and apps, I know your sales policy won't be very successful. This is my thought
It is not a third-party API I designed it to improve my queries since the v4 api was heavy with large queries and did not allow me to perform searches to filter the api to which I refer is my property and it is optional to use it and totally free without additional costs. the only condition is to use your own Google sheets api key. and as it is b4xlib you could easily see the source code. I will even leave an example of how to read a sheet with the api v4
 

fernando1987

Active Member
Licensed User
This is an example with the normal v4 api

ReadGsheet API V4:
Sub GetSheet
table1.ClearAll
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://sheets.googleapis.com/v4/spreadsheets/17YACjfqxKHDCXM_N7Jnq9BC_KzzkEgXLKzHDwaIM5Zs/values/Example!A2:Z?key=xxxxxxxxxxxxxxxxxxxxxxxxx")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim parser As JSONParser
        parser.Initialize(j.GetString.Trim)
        Dim root As Map = parser.NextObject
        'Dim majorDimension As String = root.Get("majorDimension")
        Dim values As List = root.Get("values")
   
        For Each colvalues As List In values
            
  Dim id1 As Int = colvalues.Get("4")
            Dim create As String = colvalues.Get("3")
            Dim Telephone1 As Int = colvalues.Get("0")
            Dim Age1 As Int = colvalues.Get("2")
            Dim Name1 As String = colvalues.Get("1")
            If colvalues.Size > 0 Then
             table1.AddRow(Array As String(id1,Telephone1,Name1,Age1,create))
            End If
       
        Next
        Dim range As String = root.Get("range")
        Log(range)
    End If

   

    j.Release
End Sub

This is an example with Gsheets2Json API

ReadGsheet Gsheets2Json API:
table1.ClearAll
   
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://gsheets2json.xyz/api?api_key=XXXXXXXXXXXXXXXXXXX&id=1FHx-a_a4afTQ3L5hXJIOttCVaJNngO3113E-qqFOjbk&columns=false&sheet=Example")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success = True Then
        Dim s1 As String = j.GetString.Trim
        Dim m As Map = s1.As(JSON).ToMap
        Dim rows As List = m.Get("rows")
        For Each colrows As Map In rows
            Dim id1 As Int = colrows.Get("1")
            Dim create As String = colrows.Get("created")
            Dim Telephone1 As Int = colrows.Get("Téléphone")
            Dim Age1 As Int = colrows.Get("Age")
            Dim Name1 As String = colrows.Get("Name")
            If colrows.Size > 0 Then
                table1.AddRow(Array As String(id1,Telephone1,Name1,Age1,create))
               
            End If
        Next
    Else
       
    End If
   
   


   
   
End Sub


As you can realize in the first they would need to know the range which is a bit complicated the second way I would only need to know the name of the sheet the rest will be calculated automatically

Maybe it is optional that you want to integrate it into your projects can do it in the way that makes it easier, sorry not to be able to lower the cost of the libraries anymore the implementation is very simple and can be implemented for both B4A, B4I and B4J unlike the source code that is only for B4A.
 
Last edited:

fernando1987

Active Member
Licensed User
Dear, the Library is already published together with the respective examples:


Thanks Erel without the Google OAuth2 class it would not have been possible to use the api. Thanks a lot
 
Top