Spreadsheet Setup

Hi, I've been trying to work with the new Spreadsheet component. I followed the instructions for its setup (Google Sheets API Setup), although the json file dowload was a bit different (there are differences in the 4th step).


I am testing the read / write functions, as it could be seen in this capture.

My configuration is as follows:

I shared my GoogleSheet:
MIT-Sheet-04

And I wrote the properties and upload the json file:
MIT-Sheet-03

I can't find my mistake, thanks in advance.

CredentialsJSON should be the name of a .json file that you downloaded from the Google Console and uploaded into your app's Media folder.

That space in the project name looks like trouble.

Be sure to have the Sheets Error catching event in your app for each sheet component, and have it Notify of its errors.

It is a .json file.
MIT-Sheet-05

Just erased the space in the project name, it wasn't.

I had the .ErrorOcurred event block, but it doesn't show anything.

What are you missing in your observations?

(I don't use the LogInfo Notifier. I use the popup with a button, so I don't miss it.)

Are you getting completion notifications?

Here's a tutorial spread out on a thread, at

with block samples.

I have not seen sheet names with spaces in them used before with that component.

Try a new sheet with a name that does not have blanks in it.

Also, I have not seen Write Cells into non-existent cells yet.

Try some AddRow calls to build up some rows first before trying to hang cells in mid-air.

I generated my json file for Desktop APP:

When I selected "Android" to create the certificate, it asked me the Package Name and the SHA-1 certificate:

You have to be in the Service Account section.

I suppose you have seen
http://ai2.appinventor.mit.edu/reference/other/googlesheets-api-setup.html

Yeah, I tried my setup following that document. After your notification advice, now I can see the error: "ReadCell: Error reading credentials from stream, 'type' field no specified".

(I also erased the space in my sheet name).

I would try a Read Sheet block for starters , to factor out individual cell problems.

I assigned this thread to a MIT developer, in case they can recognize that internal error message.

Thanks, I hope they identify my error.

I tried the Google Sheets / Google Forms option, it worked very well, but this Spreadsheet blocks seem better, I'd really like to use them.

In the meantime, try the ReadSheet and AddRow blocks, to narrow down the problem.

I'm not sure how much time I have to troubleshoot at the moment.

The first test project I would create would be a button and a label.

On the Button.Click event, call the ReadSheet block for your spreadsheet.

On the GotSheetData event, set label.Text = sheetData

On the ErrorOccurred event, set label.Text = errorMessage

That's the most basic app I can think of to test if you are connecting with your spreadsheet at all.

Also -- obviously this won't work for an empty spreadsheet, so it has to have some data.

If this fails to do anything at all, I would guess that the problem is in the credentials json somehow.

MIT-Sheet-08

Similar error :frowning:
"RetrieveSheet Error: Error reading credentials from stream, 'type' field no specified".

It's your Service Account key, according to that message:

You used an OAuth key instead of a Service Account key.

Here's a direct link to Google's doc for service account creation ...

1 Like

Here is what the JSON file might look like in Notepad++