# Please help me with this code!

**URL:** <https://community.thunkable.com/t/please-help-me-with-this-code/3675630>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, beginner, help\
**Created:** [March 20, 2025, 10:51pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630 "2025-03-20T22:51:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 20, 2025, 10:51pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/1 "2025-03-20T22:51:13Z")

</div>

So, the thing is, I want to know if the email, registered through direct method is signing up or signing in user.

and It’s possible  
if I can check if firebase DATABASE have the email registered or not.

I’m saving data from User ID, but when user sign in thorugh google again NEW User id will be created, from same EMAIL.

I don’t want that to happen,

So, please tell me how can I check if user is signing up or logging in.

 ![help 2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/3/d37254555dcad2d5837fd01b3074865096dc9d58.png)  
 ![help](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/6/666cabc509b5478f5723aec7abb26697010a44ab.png)

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 21, 2025, 8:00pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/2 "2025-03-21T20:00:51Z")

</div>

Typically I wouldn’t use Firebase as a Database, mostly because the connection between Thunkable and Firebase is **used only for authentication.** Instead, use Google Sheets as an alternative to have the ability to access and change the spread.

Let me explain further into detail what you can do (scroll down if you want to skip this):  
Whenever the Google account is recorded onto the app with the `get profile from Google` block, you can add a new row containing whatever info you need later on in your app. The Google account will actually stay signed in even if you close the app until you call a command that signs out your Google account. You can set variables for the blocks like `User ID`, `Display name`, `Profile photo image URL` and others too.

Whenever the “Sign in with Google” block is clicked, you can append a new row with all your variables. The next time someone signs in with the same account, grab a block that can search through your data and look if the account has been created already or not.

```auto
when google Click:
  set stored variable auth method to "Google"
  get profile from Google:
    if inputEmail ≠ list of values in (spreadsheet) in Sheet1 in Default View in (specific column):
      create row in (spreadsheet):
        "Insert variables into placeholders"
      call Alert1 Show:
        with output - was confirmed
        set Alert1 message to "Welcome!"
        then do:
          navigate to Form1
    else:
      call Alert1 Show:
        with output - was confirmed
        set Alert1 message to "Welcome back!"
        then do:
          navigate to Form1
    "Then continue your code below"

```

If you need any more help, let me know or contact Thunkable Staff and more reliable help.

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 7:11am UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/3 "2025-03-22T07:11:00Z")

</div>

I wanted to use firebase for speed and real time sync.  
Thanks for your idea of google sheets btw!  
But I think firebase is more faster for real time data and sync.

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:22pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/4 "2025-03-22T15:22:28Z")

</div>

I asked @tatiang about the reliability between Firebase and Google Sheets. While Firebase has better security, Google Sheets has more ease of usage. And while you are correct for real time data sync, Google Sheets updates every second. As long as your Google Account is connected with Thunkable and your Drive is accessible, it should work the same. Firebase gives a more complex but thorough state in the Realtime Database, while Google Sheets is just for storing a little bit of data.

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:23pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/5 "2025-03-22T15:23:41Z")

</div>

Try this out and see how it goes; please do not delete your original code. Keep it unattached from a `when` block and insert your new code that I have provided. Good luck!

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:24pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/6 "2025-03-22T15:24:04Z")

</div>

Used, firebase API, connected it and got a dictionary from DB,  
NOW,

The question is how to read a value of a dictionary?

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:26pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/7 "2025-03-22T15:26:39Z")

</div>

Here is something you could use:

> [@Is Firebase a reliable database for Thunkable?](https://community.thunkable.com/t/is-firebase-a-reliable-database-for-thunkable/3678463/2):
>
> Ease of use: Google Sheets over Firebase by a lot Security: I’ve heard Firebase is more secure You would use cloud variables where the name of the cloud variable is the full path to the property in the Firebase Realtime Database. It took me a while to feel comfortable using Firebase. But it’s flexible and fast.

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:26pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/8 "2025-03-22T15:26:54Z")

</div>

Google sheets is

- slow
- not good for storing large data

and I’m using firebase for better security and efficiency.  
Your idea about google sheet was good, but only is

- The app is not going to include a large group of people.

I used firebase according my need. But if it was a small scale app, I’d for sure consider your idea!

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:27pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/9 "2025-03-22T15:27:43Z")

</div>

Exactly what I meant!

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:28pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/10 "2025-03-22T15:28:50Z")

</div>

By any chance you know how to

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

read data from a dictionary? tht too through a loop?

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:29pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/11 "2025-03-22T15:29:55Z")

</div>

It is not my opinion to choose your chosen database. Google Sheets and Firebase can do the same things. I’m not specialized in using a proper database through Firebase. You may want to contact the support team for more help, unless I find a better solution.

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:30pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/12 "2025-03-22T15:30:32Z")

</div>

Could you show me your code on how you implemented this?

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:34pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/13 "2025-03-22T15:34:13Z")

</div>

Sure!

used firebase API, jumped directly to the users section through it!

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

then made THUNKABLE CODE looked like:

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

and got this

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

as result

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:35pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/14 "2025-03-22T15:35:29Z")

</div>

If I find the solution myself, I’ll post it here and mark it as solution!

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:36pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/15 "2025-03-22T15:36:37Z")

</div>

For sure! I’m sorry that I can’t help much, but I sincerely hope someone actually does help. Good luck on completing this! I will continue to look for an answer ASAP.

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:37pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/16 "2025-03-22T15:37:00Z")

</div>

Thanks for your kind efforts!

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [March 22, 2025, 3:41pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/17 "2025-03-22T15:41:02Z")

</div>

My reason for using Google Sheets is to insert it into a Data List/Grid viewer. That’s also one of the main reasons why I actually don’t use Firebase. Maybe soon it can change. I will put it as a feature request (check my profile later on this week)

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 3:45pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/18 "2025-03-22T15:45:23Z")

</div>

Sure!

---

<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:** [March 22, 2025, 6:05pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/19 "2025-03-22T18:05:15Z")

</div>

> [@schoolwork7002lro2tb](#):
>
> By any chance you know how to
> 
> ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/a/faaacbc07b3543b64ba88d721b719350698fc0b4.png)
> 
> read data from a dictionary? tht too through a loop?

You can paste that JSON text into [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer) on the left side and then on the right side click on a property such as “email” to see the path to that property. You can use get property of object blocks in Thunkable to extract the values you need.

If you’re trying to loop through multiple entries like that, it’s best to paste the full JSON response as text (not a screenshot) in a post here. Make sure to format the text using the \</\> in the forum toolbar above your post. That will remove smart quotes that prevent the code beautifier site from reading the JSON.

---

<div class="post-metadata">

**Author:** ![schoolwork7002lro2tb](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@schoolwork7002lro2tb](https://community.thunkable.com/u/schoolwork7002lro2tb)\
**Post date:** [March 22, 2025, 7:43pm UTC](https://community.thunkable.com/t/please-help-me-with-this-code/3675630/20 "2025-03-22T19:43:28Z")

</div>

> [@tatiang](#):
>
> You can paste that JSON text into [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer) on the left side and then on the right side click on a property such as “email” to see the path to that property. You can use get property of object blocks in Thunkable to extract the values you need.
> 
> If you’re trying to loop through multiple entries like that, it’s best to paste the full JSON response as text (not a screenshot) in a post here. Make sure to format the text using the \</\> in the forum toolbar above your post. That will remove smart quotes that prevent the code beautifier site from reading the JSON.

Whole JSON from directly firebase:

```auto
{
  "Data": {
    "exampleKey": "exampleValue",
    "users": {
      "105911822131142675060": {
        "email": "work7002@gmail.com"
      },

      "925911822131142675460": {
        "email": "school7002@gmail.com"
      }
    }
  },
  "organization": {
    "kuro": "sfjg"
  },
  "thunkableAccess": true
}

```

What I got using API:

```auto
{"105911822131142675060":{"email":"work7002@gmail.com"},
"925911822131142675460": {"school7002@gmail.com"}}

```

After using **FIREBASE API** this is where I got.  
I want to check if email is already in the Database or not.

If it is then under what userID (the numerical code)

[Next page](https://community.thunkable.com/t/please-help-me-with-this-code/3675630.md?page=2)
