Testers Wanted: Google Sheets component

So this is one of those fun (?) little details about how the internals of App Inventor works that causes things to break in odd ways. As a workaround, you could assign the result to a label's text field and then use that in the data. The internal fix is straightforward but likely an edge case the original implementor did not consider.

(added to Open Issues section of FAQ)

Confirmed that passing the text through a Label.Text defused it.

I couldn't spot if this issue has already been raised.

I tried to AddRow to an empty sheet on a spreadsheet.

This returned an error and did not "post" the data to the sheet:

"AddRow: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference"

Everything worked fine once I had at least the first row with some data in it (even just A1)

1 Like

Bug confirmed on an empty sheet:


(added to Open Issues section of FAQ

@Susan_Lane This seems like it should be a pretty straightforward fix. Please take a look.

This is new to me, a 0-based row number return in filtered Get Rows request reponses.

I encountered this trying to do a simple sample of logging Arrivals and Departures in the same row.

I used my NYC Marathon sample as a framework, with an extra sheet for Arrivals/Departures:
ArrivalsAndDeparturesOffset bug

Notice how this bug overwrote the Departure Time heading on column D, and logged Departures one row too high (-1 row) for each update.

Adding Arrival Times is straightforward:

  • Add a new row with just the arrival time and other details, departure time 0.

Adding Departure Times is a two phase operation,

  • ask for a filtered list from the Arrivals/Departures log for the runner in question
  • Take the last row number from the returned row number list.
  • Use it to update column 4 (D) of that row number.

Here are the blocks:

The incriminating Do It result for the first occurence, where the column 4 heading got overwritten:

The exported .aia file, if you want to play:
MarathonSheetsWithArrivalDeparture.aia (20.0 KB)

The sheet:

If you have a previous thread where this error was found, please point to it.

I'm not sure how Sheets Component handles headings. Have you worked with column headings before?

Headings are pretty much required, due to the AI2 bug that doesn't let you add rows to an empty sheet. (See FAQ)

But it's not about the heading.
(Headings are not special in Sheets. They are just dead text in row 1.)

It's about using 0 as the base instead of 1 as the base for identifying rows.

I see. So are all the row identifiers off by one, as in its 0-indexed rather than 1-indexed?


For a query that matches rows 4,5,6 the returned row numbers are 3,4,5.

That's indicative of a 0-based row enumeration.

Notice in the attached Do It how the row numbers for a filtered query on 'abg' are 1 off the row numbers in the sheet screen shot.

1 Like

Yup. This is not how it should work. I'm putting it on my issues to fix.


Greetings, @TIMAI2 If the problem is not fixed, kindly describe the procedures necessary to duplicate it in any video. You can also give me the.aia file, which will make it simpler for me to access it.
Many thanks

Talking about this issue "AddRow: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference"

I believe that this either has been fixed on ucr or there is a pending PR to fix it. We're in the process of updating ai2-test with the next release candidate and will be making an announcement later today for people to help test it.


ohk , thanks for the info

1 Like

Spreadsheet component, no credentials, google sheet set to anyone with the link

This fails and crashes companion, no error message:


I suppose println is accountable for this problem.
It says println needs a message.
here you can see the logs behind this :

Process:edu.mit.appinventor.aicompanion3, PID: 8351
      java.lang.NullPointerException: println needs a message
      at android.util.Log.println_native(Native Method)
      at android.util.Log.d(Log.java:158)
      at com.google.appinventor.components.runtime.Spreadsheet.ErrorOccurred(Spreadsheet.java:338)
      at com.google.appinventor.components.runtime.Spreadsheet$15$1.run(Spreadsheet.java:1724)
      at android.os.Handler.handleCallback(Handler.java:938)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:255)
      at android.app.ActivityThread.main(ActivityThread.java:8212)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)

It is indeed a bug with the component, from the lines #1724 and #1801

Could you send me the project?