🟩 [FREE] GS Connected - A Swiss Army Knife for Google Sheets

gsConnected

This is an offshoot from my GDConnector extension, and could be considered to be the big brother of my Google Sheets for AppInventor extension.

With this extension, the blocks and the google apps script will only use the google drive and google sheets stored on the developers google drive - the one who sets up the apps script. This removes the need for any authentication, but does have privacy issues for users.

You will be able to perform some basic drive functions to create folders and sheets, and then a wide range of sheets functions to allow for full CRUD functionality (Create,Read,Update,Delete), and much more, on google sheets. By using a google apps script, you can work with private or public spreadsheets.

  • Latest Version: 1.0
  • Tested: This has been tested on App Inventor 2 using Android 10 and 12 devices, companion 2.62, and compiled apk. It may work on other derivatives....e.g. Kodular/Niotron/etc.
  • Released: 28 March 2022
  • Last Updated: 28 March 2022
  • Built: Using the Rush Extension Builder by @Shreyash
BLOCKS & USAGE

image

When working with ranges, rows and columns, please pay particular attention to the list structure format requested for each type. This is shown in the bocks (selectionIndex 18 - for example). ensure you have ShowListsAsJson ticked in your Screen1 Designer properties.

SCRIPT & SETUP

ScriptGSConnected.txt (13.4 KB)

Once you have created your new apps script, delete anything in Code.gs and paste everything in the above txt file. Save, then publish as a web app, with "Me - your google account" and access to Anyone/Anyone even anonymous. Get the script url for use in your app.

How to create a google apps script web app - you can use a bound or a standalone script for this.

EXTENSION

The extension will only work once the google apps script is in place
uk.co.metricrat.gsconnectedV1.0.aix (15.2 KB)

Enjoy :smiley: , and all feedback, comments and ideas for further development welcome.

Available for use in any MIT AppInventor projects or competitions

17 Likes

@TIMAI2 where we can get sheet id

I think if your sheet URL is

https://docs.google.com/spreadsheets/d/ABCDEFG/edit#gid=12345678

then your sheet ID is 12345678. The sheet ID for Sheet1 is 0.

Yes, the sheet ID should be text/number/both.

1 Like

I am using sheet1 so Am I need to enter 0 in
SheetId

I think you will find sheet id in the url and sheet name at the bottom.

1 Like

2 Likes

A page or tab within a spreadsheet. A Sheet resource represents each sheet and has a unique title and numeric sheetId value. You can find the sheet ID in a Google Sheets URL:

https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId

Sheet ID is an identifier of a Sheet in a Google Spreadsheet file. To obtain it, open the file for the desired Sheet, and locate it at the end of the URL after 'gid=' : https://docs.google.com/spreadsheets/d/1EwXZweUNKKGSC6k6_6IkukyRFeNzi7qEIIjOAC9_vGA

Where can I find the S... | Meiro Docs.

https://docs.google.com/spreadsheets/d/FILE_ID_HERE/edit#gid=SHEET_ID_HERE

There is some confusing stuff here, especially from Gordon :wink:

I have updated the extension to rename SheetId to SpreadsheetId:

image

Here is a google sheet url:

https://docs.google.com/spreadsheets/d/1IdpGILd7Nii8nq5yb2Uq3kVFyyL50eo5la2xbDN1Cok/edit#gid=0
The spreadsheet file ID = 1IdpGILd7Nii8nq5yb2Uq3kVFyyL50eo5la2xbDN1Cok
The gid (gridId) = 0

This is the default gid for the first sheet in a spreadsheet when the spreadsheet is created.
Additional sheets (grids) will have a longer number for their gid, e.g. 331107384

The sheetName = Sheet1

for the first sheet in a spreadsheet when the spreadsheet is created. The user can rename it as they wish. This is shown on the spreadsheet along the bottom, as indicated by @oseamiya and @dora_paz above, and here below
image

The extension requires a SpreadsheetId and a SheetName. These can be set in the Designer, or with blocks at runtime.
image

The gid is not used in the extension.

7 Likes

Thank you, now everything is cleared! :star:

I am getting html code in listview when I am using this extension

Maybe post a screenshot, works fine for me

This indicates an error with the url being sent, or the script is not setup correctly.
The error message is usually at the end of the html.

Can you please tell me what are the things we need to edit in ScriptGsConnected.txt

Just copy ScriptGSConnected.txt, delete everything in the script editor and paste.

My steps are

But I am getting error

How can I access the data in a Cell of the Spreadsheet ?

image

image

and just use a single cell reference, e.g. A4

But how can I assign the value (text) to a variable ?

It is a void method according to the image right ?

Edit : OK I just saw the GetFunctionOutput()

But could you make this as a value returning block in the next update ?
Cuz it becomes quite complicated to get the variables to the exact values. (I know a way though, but still it becomes quite harder.)

You have an event called GetFunctionOutput. Use this concept and translate this into blocks.

if (event = GetRangeData) {
set variable to output;
}
1 Like