Google sheets not displaying the correct firebase user id

below is this student sign-in function. the function is designed to where once the student signs in to the app, a row would be created in the “Class Data” google sheet displaying their information. through several trials, when i would sign up with my school email, i would take note of the user id that is given to it in the firebase console. each time when i sign in, the column in the google sheet displays the user id that was last stored instead of the current one

this is the id in the firebase console

and this is the id in the google sheet’s newest row
image

i feel like the issue may be that i keep deleting and remaking accounts in firebase (for testing purposes), but i’m unsure. how could i get the google sheet to display the current user id?

There’s a few weird issues to sort out

First

In your login flow, if you want to do something after waiting for Firebase to respond (which you do) you need to put that code within the “then do” section of the sign in blocks.

Also, you are doing stuff after switching screens. This can result in unwanted side effects. Make screen changes the last action in the sequence.

1 Like

i did the necessary changes, and the sheets show the current id now! a new issue showed up though, and that is the “Student Email” value now shows up blank on the sheet :\

You need to fix the two issues that @jared mentioned. They still exist in your newest screenshot.

image

image

so now i understand the “navigate to home” needs to be the very last block, but i still don’t get what needs to be in the “do” part

Move the second create row block into the “do” section of the first create row block. Although since they are different data sources, it shouldn’t really matter.

Additionally you are executing synchronous code synchronously with your function calls to save user data without waiting in a return. Could be causing issues.

not sure if this is the best solution, but i made changes to this function and it got me the results i was looking for (so the email now does show up in the “User Data” sheet when a new row is created)