API2 is uploading some files from Google Sheets but not others--happens for different files on different startups

I've made a rather complicated app (a trivia game) for my family to enjoy (not for commercial application). My test data at first was incorporated into the app (6 categories, 4 questions each). I wanted to add more Q&As but didn't want to do it the hard way by adding one line at a time within the app for the answers (in csv format). I was very successful in getting the questions properly imported to the app and then I did get the answers to finally work the way I wanted them to work (my program randomizes the questions so the correct answer is not always in the first button choice.

After that success, I felt confident to add the rest of the Q&As (still only 6 categories and 4 answers each) to import them from Google Sheets. It worked perfectly. Now, however, it suddenly will load all the questions from all 6 categories, but randomly only upload some of the answers (6 files for questions, 6 files for answers). It'll work one time for 5 out of the 6 and I'll run it again and it'll pick up only 4 out of the 5 answers. The questions work every time so I know it is reading the files correctly.

I thought it was a problem with too much too fast so I tried putting in some timers to slow down the import. That worked once, but again the random importing of answers started again. Can anyone help with this? Is this a bug that needs to be fixed? I ensured that I am up-to-date on API2 (Oct 19, 2022, version nb190b, and I am using Companion Version 2.65). Why does it work one time for 5 or 4 out of 6 categories but then not work for a category that was working and stop pulling data for another that was just working?

I'm pulling my hair out--I was really hoping I could have this app ready for us to all play for Christmas. We always play games but my oldest son is autistic and he doesn't really play the ones his brothers and I play so I created this app to quiz on all the categories he loves (everything Hollywood, movies, TV, etc.). HELP PLEASE!! I'd REALLY appreciate it, thanks!

Sorry Sandy, without you willing to share your code Blocks /and or an aia file, no one is able to test your app.

Are you downloading from the sheet every time you change categories?

Here are some ideas that might get you to finish by Christmas.

  • create separate apps accessing the same database for each Category rather than one single monster app..
  • download the entire data base as separate csv for each category and store on the device in a TinyDB. Do that and you will not be at the mercy of downloading from the cloud. This takes time to query, download and reset your csv appropriately.
  • Do you switch Screens? The app takes a while to move to another screen and that might be part of the timing problems. You might use a different way of selecting correct question answers. Here is one method How do you make a quiz in one screen? - #23 by SteveJG
    Also look at another example in the discussion it links to How do you make a quiz in one screen? - #60 by SteveJG

Other community members may have other suggestions. Be careful of your timers. You do not want the timeInterval the same on all the timers to avoid 'collisions' for instance.

Merry Christmas.

I'm happy to share the code. I'm attaching the *.aia file.

I will warn y'all that my "coding" skills have always been a bit complicated and I'm sure with many potential redundancies (haven't had a computer science class in ages, but I remember my programs being much larger than they needed to be--probably why I became an accountant instead!).

Again, WARNING, while the project is only 2mb, it's extensive. I did delete a bunch of images (all the Avengers!) as potential players (it won't look like I did--I deleted 21 and kept 16).

Thanks, Sandy
PS - I hope that's right how I uploaded it!

RestartingRestart(1).aia (2.0 MB)

Oh, BTW, I did change the timing on those "timers" - they were all set at 4 so I just incremented them by one, but that still didn't work. Thanks for your patience!

And, forgot to answer this one, no it's only one screen (rather large one I'd say). I knew some folks had issues with multiple screens and I didn't want to take a chance.

Also, I didn't click on that link, but I'm 99% sure I saw that link on how to make a quiz back when I started this program a couple of years ago. I wasn't running into this issue back then, but I tried to tweak it based on my sons' input at Christmas and then I crashed it. I decided to try one more time and I am pleased overall with the results if I could only get it to bring in ALL the answers.

I just clicked on your link and see it was a rather recent one. The fellow that made his quiz, I see he didn't want to pull in files. Ironically I literally did exactly what he did by way of the questions and answers, and--as you said--that was very awkward but at the time, I was just testing 10 questions for each of the 6 categories.


In fact, you have eleven timers, all with their TimerInterval set to 1000 ms using the control Properties except two which are set to 0 .

By staggering, I meant they should be set to perhaps 1000, 1001, 1021, etc. so as to minimize the possibility of two or more firing simultaneously. Setting TimerInterval to 0? Why is full_spin and and final_spin a mistake?

I did not try this, just examined the Blocks.

1 Like

I thought for a moment you had somehow fixed it as I ran the program again thru companion and it worked.

So, I thought I'd go ahead and download it on my phone; however, great disappointment because now this is the message I'm getting: "Select list item: List index too large - Select list item: Attempt to get item number 1 of a list of length 0: ().

This is pretty much the exact same message I was getting when it wasn't working. Sad face!

I see you responded, I'll take a look and be hopeful.


Redundant on the timers??

I will go change those so they don't fire at same time.

As for full_spin and final_spin question, I'm not sure what you're asking as it being a mistake. I believe (it's been a couple of years as to when I programmed that--which works--but I think I wanted the spinner to go around a couple of times before it stopped (just for visual effect).

Just in case you're wondering, I effectively tried to emulate Jeopardy and Trivial Pursuit in the same game. I know my son would understand those cues (don't know if I mentioned it, but he's autistic--hence him not playing with us very often if at all--only if it's trivial pursuit games with subjects about Hollywood).


still looking. You probably only need one or two. These can be resused. I haven't found where you turned the 'unused' timers off. They appear to be always enabled = true, which is not right.

You have 3830 Blocks (which is a lot but doable)

I ran it once using Companion. It refuses to populate your Buttons.

Sometimes compiling works when using live development does not. That is not working for you or me. :cry:

Did you mean always fires? I just checked and only the always fires is checked on almost all of them.

I will try un-clicking all of the fires boxes and try again.

Yes, MANY blocks!

I do appreciate your help more than you could possible imagine! I've been trying to troubleshoot this one for DAYS and I mean DAYS--full days from like 0730 til 7 p.m.! At least is saves me from watching some of my son's icky choices for Christmas movies (I feel bad when I don't want to watch them with him, and yet, not so bad, LOL!).


My mistake, the last couple of timers were marked for enabled. I unchecked along with always fires, but that didn't work. I'm going to add back the always fires where I had it before and HOPE that works. Maybe you solved the greatest mystery of 2022, LOL!

Sadly, that didn't work--this time it's coming up with Reload Questions for the TV category right at the start.

I thought perhaps the "Again Play" button that I added to the winner page because I didn't want the program to start again from the beginning in case we play more than once. I deleted that button and the block that corresponds to it has been disabled all this time. I thought that was the issue, but it's back to wanting to reload questions for TV category.

Of note, it fails when picking a category low on the category list. It runs with the first category.
Unfortunately I have one right with over 20 selections.

No. What I meant is that they all are always running. That many timers running all the time does not make sense and uses cpu constantly. If the category is not being currently used, the Clock associated with the category should be disabled, then enable when the appropriate category is selected. See Clock documentation.

Game is pretty neat and clever but its complexity is causing issues.

Yeah, I was so happy when I finally figured out how to randomize the answers coming in from Google (that perplexed me for many other days).

But of course I have to tweak and when I ran that block that's disabled and added that Again Play button, it started crashing.

I'm pleased that you like it. I worked hard on it and while I know I can make it simple, for some reason simple has never been associated with me, LOL! I always seem to complicate everything (personality flaw?).

I know it all worked just fine before that last tweak. My only worry was when I tried to upload a ton of questions and answers--I assumed THAT would blow it up, but never expected it to stop uploading my answers.

I'm not sure I understand what you mean about "low on the category list". Marvel is the second list to be pulled in and yet that one almost always doesn't load. Now, of course, I'm getting the reload questions for TV (indeed issues!).

I'm just HOPING you'll see something that I'm too blind to see. Just running this by you has given me ideas and potential fixes. I hope you don't run out of ideas as I do appreciate them!

I'm going to try something crazy--I'll pull in all the answers first and see what happens (i.e., take all the timers off that initialization screen and put them back in that block (no extra procedures). I'll let you know what happens (experimentation is so-so fun!).

Sadly that didn't work. Marvel was the first one to populate and did so correctly. Next question was the TV category and while I got the questions, there were no answers. Next was Star Wars and same as TV. Then Animation and Movie categories came up correctly. Only to end with Star Trek having no answers.

I'm not sure I can figure out this rhyme or reason. Here's a snapshot.


What to do?

Make a copy of your Project and SAVE the aia.

Then start experimenting. I would code the Clock to only be enabled when the Category is live
I would disable half of the Web components and see if that ameliorates the problem. and do similar things.

Did you make an aia at that point. If so revert to that version.,

last items in the category List .

ok I just found some code where you do disable the Clocks. :slight_smile:

Yes, I'm 90% sure I made a copy of the working file before I tweaked it (hence the odd name for this project).

I did try taking the files out of the initiation screen and putting it in the StartGame block and while I was optimistic when Animation, Star Wars, and Marvel came up correctly, when Movies and TV came up (I waited out the 30-second clock), they both bombed.