Spreadsheet component. Example. Google Sheets

In order to utilize this component, one must first have a Google Developer Account. Then, one must create a new project under that Google Developer Account, enable the Google Sheets API on that project, and finally create a Service Account for the Sheets API.

How to create the Service Account, here:
http://ai2.appinventor.mit.edu/reference/other/googlesheets-api-setup.html

At the end of the whole process we will obtain a file of the form:
app-inventor-338017-8c72fd465555.json

We must upload that file to our application.

Let's look at an example:

p138_googlesheet_2.aia (5.9 KB)****[This app doesn't work because the identifiers are fake keys.]

3 Likes

no entendí nada te puedo enviar un mensaje privado con mi archivo aia?

First you need the json file which you can get at...

create the Service Account:
http://ai2.appinventor.mit.edu/reference/other/googlesheets-api-setup.html

entonces tengo que cambiar todo el codigo de la aplicacion
no puedo usar el anterior acabo de cambiar un archivo de Excel,
te puedo dar el archivo en privado?

Hola, buenas tardes. Estoy empezando a usar el componente SpreadSheet y he seguido todos los pasos para obtener el archivo .json y las credenciales. Tengo un archivo creado con los permisos otorgados (el usuario que me da la cuenta de servicio), pero en App Inventor, cuando voy a emular la aplicación, me da el fallo "Runtime Error. Cannot find the component: SpreadSheet1". He revisado todo paso a paso e incluso he probado con su ejemplo (cambiando el archivo .json por el mío y poniendo el ID correcto de mi hoja de cálculo) pero me ocurre lo mismo. ¿Sabe por donde puede venir el fallo?

Saludos

What version does your MIT Companion have?
Upgrade to 2.65

Hola de nuevo. En efecto, ese era el problema. Muchas gracias por contestar. Saludos!!

Hola, buenas tardes! Estoy haciendo una pequeña app y me encuentro con algunas dudas. Gracias a su ejemplo he aprendido mucho acerca del componente Spreadsheet, pero, en caso de tener una columna con 50 items que he rellenado manualmente desde el ordenador, por ejemplo, y quiero añadir uno nuevo, ¿cómo hago para añadirlo en una celda vacía (la 51)? ¿Se puede hacer con bloques o habría que hacer un script?

With WriteCell
A51

Gracias por su respuesta. Pero, en el caso de que la aplicación no sepa qué celda está vacía en ese momento (podría ser la A50, o cualquiera), ¿se podría programar por bloques la búsqueda de la celda libre disponible (he visto que el componente Spreadsheet tiene muchos recursos pero no encuentro ningún ejemplo para basarme en él) o habría que acudir a un script (un bucle for para hacer un recorrido de búsqueda)?

Saludos

I believe you use the AddRow method to append a new row of data to the first empty row of the worksheet.

1 Like

getreference

Got:
A1
B1:D3

  • You can get the number of items in a column by ReadCol

1 Like

I'm using the WriteCol function but advice error in the app saying "The operation WriteCol cannot accept the arguments: ,["Sheet1"],[2], ["John"]

What means that? I cannot send datatext from some variable, is just for using as a list?

Like so

image