Google Sheets call back issue

I'm saving a database to Gsheets and my workflow is to clear 200 rows and then save the data. With my current blocks I can do this separately but when I try to use FinishedClearRange, it doesn't fire:

To start off saving the database, I want to clear the old data first.

Then after I get confirmation that the clearing operation has completed, I will save the rows:

However, even though I can verify that the spreadsheet has been cleared, the "FinishedClearRange" function never gets called and the rows never get saved.

Anyone have any insight?
Thanks!
-Bryon

Hello Byron

I think your code needs to first verify that the whole range exists before it is Cleared.

Hi Chris!

The code seems to be quite happy to clear the cells. I populated the cell at F200 and it clears just fine. Not sure what other functions or callbacks I need.

I know I could forego the callback completely and just use the clock to create a delay but that is not the right way to do it. Waiting for the "ack" is the best.. if it's working.

Thanks.
Bryon

That's not the same as a range of cells though.....

Technically, you're right. But I did have lots of data in the range and it cleared. Placing data in F200 is easy for testing.

Seems like a bug.

It does, but it is a very straightforward case, no more complicated than the testing would have been before release of the App Inventor enhancement.

The difference between the calls: Clear Range is a signal sent by the App. Finished Clear Range is a signal sent by the Google API. Make sure your Google User, Google API, Google Project, permits that outgoing message.

If this is the AI2 component then @Susan_Lane should be contacting you.

Can confirm the event does not appear to be firing, the method (clearing the range does work)

image

On pressing Button 2, the range is cleared on the spreadsheet, but the label is not written out with "Cleared Range".

1 Like

I changed the sheetName to Sheet0 (there is no "Sheet0") to force an error on Google's side and did receive a correct error response from Google's API confirming the connection permissions:

"Unable to parse range: Sheet0A1:F500"

Yes this does appear to be an issue. I've logged it here and proposed a fairly straightforward solution on our end.

1 Like

That was a good idea.

Great! Thanks for looking into and logging this. Also, thanks to everyone else here as well for their ideas and testing!

-bryon

1 Like

Thanks for this report and all the details.

(added to Open Issues section of FAQ)

We have merged a fix for this issue. It should go out with our next release.