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.
-
Here more information:
Testers Wanted: Google Sheets component -
With GetCellReference you can get the reference of a cell or set of cells, example
Got:
A1
B1:D3
- You can get the number of items in a column by ReadCol
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
I am trying to identify why my app will not write to my Google sheets file. I have set everything up in Google Cloud. Here are my blocks and the error message I receive on my phone when using the emulator.
Set CredentialsJson is expecting a file, you are providing a code.
Set Spreadsheet ID is expecting a Spreadsheet ID, you are providing a file path
I made the corresponding changes but I am still getting an error. Attached are my blocks and the error that I am receiving.
Have you tried setting the credentials file in the Spreadsheet component designer properties ? (and the Spreadsheet ID for that matter)
If you do try this, remove or disable the setting blocks in your blocks editor.
I ran a test, using my own credentials and spreadsheet. This works OK
more work to do at your end....
There also seems to be some kind of bug with the join block
This works
This works
but this fails (which is what you are doing in your blocks)
error message:
WriteColumn IOException: 400 Bad Request PUT https://sheets.googleapis.com/v4/spreadsheets/1IdpGILd7Nii111111o5la2xbDN1Cok/values/Sheet74!E:E?valueInputOption=USER_ENTERED { "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid values[0][0]: list_value {\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n}\n", "reason" : "badRequest" } ], "message" : "Invalid values[0][0]: list_value {\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n values {\n struct_value {\n }\n }\n}\n", "status" : "INVALID_ARGUMENT" }
This is a workaround, by first setting the joined text to a label, then the label text to the make list block in the WriteColumn method (the label does not have to be visible). Just setting the join output to a local variable doesn't work.
Thank you that worked. How would I list each individual component on the list in its own cell all on the same row?
You want to write a row, instead of a column?
If you want to append a row, use the .AddRow
method.
That's interesting. I'm not sure if that's a bug with Spreadsheet or something involving just the join block that happens to rarely affect anything.
Very interesting that a local variable also doesn't work.
It is an odd one, the join output is obviously not being transmogrified
as expected
The reason this happens is due to how Kawa handles strings. It has its own internal type called FString which acts like a rope, and so when you join strings together you get an FString reference that points to the constituent parts. This is to save memory rather than introduce a new String object that takes up the same space as the originals.
Now when we come to the Spreadsheet component, the runtime does not sanitize all of the internal types of the list when passing it the component since it doesn't know (and actually, in the Spreadsheet since numbers should also be acceptable, can't know) what the internal types should be. The component therefore should be sanitizing the list contents based on its needs. However, it passes the values through to the Google Sheets API, which does not know what an FString is or how to use it.
On the other hand, when a FString is passed to a component property/method that expects a String as its argument, Kawa will convert the FString to a String before making the call, so by assigning the result to a Label's Text property (or any other property typed as String) the FString is converted to String and then when it is passed through to the Spreadsheet the Sheets API can consume it.
Variables won't work because they are not typed, so no type coercion happens.
Is there any way to manage this in the Spreadsheet component? I believe only numbers and strings can be passed through the Sheets API, and possibly everything is effectively a string with number behavior handled by the Google Sheet before passing values to/from the API.