Loop routine to load google sheet data to firebase

Hello, wishing to load google sheets data into firebase. I’m using a spreadsheet to capture some intermediate data before I transfer to firebase for permanent storage (I could also use local data table, but have challenges troubleshooting in preview mode.

The google sheets data has multiple rows of data so I need to write a “loop” routine to work through each row and load into firebase.

This is my first attempt at the routine (failed after multiple tries).

I’m creating an event (in GameSummaryForms) tagging with a date (YYYYMMDD) and loading game number and game date characteristics.

Then I’m creating a sub-tag group (Incidents) to load all the incident data and assigning a unique incident ID (Event# and Offender), then loading incident time and offender characteristics.

Firebase Tags/SubTags look like:
GameSummaryForms

20231015
. >>>> GameNumber: text
. >>>> GameDate: text
. >>>> Incidents
. >>>>. >>>> Event#Offender1
. >>>>. >>>> Event#Offender2
. >>>>. >>>> Event#Offender3

Would appreciate any help in solving this challenge. thanks!

What specifically is or is not working?

Are you able to set a single cloud variable path (without a loop) successfully as a test?

Have you tried introducing a delay inside the loop? Often, loops that access cloud-based storage need to time to complete. Try a Wait 0.03 seconds block or even a Wait 0 seconds block to see if that helps.

First part is working (loading game number and date to GameSummaryForms >> Date

The "for each item “J” DO block is not working.

What I’m suggesting is that you need to try to set a value with a sample endpoint from the loop (/Incidents/Event#…) but without using a loop. Just a standalone test to make sure that’s possible. Not just the partial path that you’re trying above the loop. But again, if your paths are definitely correct then a Wait block may be helpful.

tatiang - good insight, thank you.

I added timers … no success.

I then re-wrote the load routine (2nd part) by removing the loop and attempting to load the first row in the google spreasheet (just grabbed rowID and inserted in the get value blocks). No success. For some reason (I’m still trying to determine), it wasn’t loading to firebase. I’m checking the join structure on the set cloud variable to ensure the tags/subtags are correct. I’m also going to re-program the loading so that I pass one record at a time (instead of multiple records).

Once successful, I will tackle the multiple record loading at one time in the future.

thanks again for your insght.

1 Like

Another insight on my part … Firebase doesn’t allow # characters in the tag/subtag structure. Your program will not load any data to firebase. This was the problem from the start.

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