Spreadsheet Setup

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++

I was generating my json in a wrong way: " You got the error because you downloaded an OAuth 2.0 Client ID instead of a [Service Account] (Utilizzare OAuth 2.0 per le applicazioni server-server  |  Authorization  |  Google for Developers) key.".

Following the Create Acess Credentials was the solution. Now I'm reading and writing cells.

Thank you so much! I owe you some coffee :slight_smile:

Thanks for the reply.

I should post the direct link to service account creation in the FAQ after breakfast.
(Done)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.