# Google sheets not displaying the correct firebase user id

**URL:** <https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, google-sheets\
**Created:** [January 13, 2024, 3:25pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362 "2024-01-13T15:25:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [January 13, 2024, 3:25pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/1 "2024-01-13T15:25:12Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/a/aa71c4f0a6e387b4e0b0eec108de79c48f68d930.png)

this is the id in the firebase console

 ![Screenshot 2024-01-13 101015](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/c/dc31bb0cc8245fcf1a77853dda42ac7c0dfdcfd4.png)

and this is the id in the google sheet’s newest row  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/6/56ffdc7026edbd5f37d649f556b3ed6906a8a633.png)

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?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 13, 2024, 4:33pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/2 "2024-01-13T16:33:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [January 13, 2024, 5:25pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/3 "2024-01-13T17:25:21Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/7/575d9c81f1ec074923d1b59ec6d0d9259845a164.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/4/f409ce328a2f8a524407d3f5fdd1697d8496d435.png)

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 :\

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 13, 2024, 6:50pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/4 "2024-01-13T18:50:46Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/b/0b62432a4bd9a8999e7ba975efdf10e1fb16f633.png)

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/e/1eb09b7f15f2b1da3286af8c0236b93e1b123ab1.png)

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [January 13, 2024, 7:10pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/5 "2024-01-13T19:10:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 14, 2024, 3:48am UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/6 "2024-01-14T03:48:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 14, 2024, 3:58am UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/7 "2024-01-14T03:58:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [January 14, 2024, 2:53pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/8 "2024-01-14T14:53:38Z")

</div>

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)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/468f90c51986de916fc235cc9b9900f80e561622.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [April 13, 2024, 2:54pm UTC](https://community.thunkable.com/t/google-sheets-not-displaying-the-correct-firebase-user-id/2781362/9 "2024-04-13T14:54:19Z")

</div>

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