Hi, i’m iki.

Today we are going to learn how to use Google Forms as a free database, sending data from Godot.

The first thing I am going to do in Godot is to create a button, which will be in charge of sending the data each time it is pressed.

For that we have to connect the button to a script.

We need a variable that we will use to hold the URL of our google form.

And yes, for all this we need to create a form.

So let’s go to the Google Forms page and start creating one.

For each piece of data I want to collect, I’m going to create a question.

The question can be of the «short answer» type, or if we want a more complete text (like a dictionary), we can choose the «paragraph» type.

In my case I am going to save the username of a player, and the coins they have earned.

Once finished, I press submit, and select the share button, to obtain the URL of the form.

Now we need to create a variable that we will use as a header, to indicate some base parameters of any HTTP data connection.

For communication we will use a node of type HTTPRequest.

As I mentioned before, we are going to send user and coins.

The username will be entered by the player himself, so I’m going to create a LineEdit node where he can do it.

When i press the submit button i want to read the mentioned LineEdit.

To be sent, it has to be stored in a variable, as dictionary data.

I’m going to create a coins variable, which you can have anywhere in your game, I’m doing it here to show you how it works.

Now I am going to adapt the header that we had created, to the appropriate format to be sent.

Since we will be sending a data package, our dictionary must also be adapted to the relevant data type for the query.

The last procedure is to make a request, first indicating the URL, second the header, then false, fourth we specify that we will send or POST data, and finally the data package to send.

We have one more thing left.

We must indicate which identity number corresponds to each data in the form.

So we are going to obtain for each data or question its identity number.

What we have to do is go to the form as if we were going to fill it out.

Then open the developer mode of our browser.

Now we complete the form with any data, and send it.

In our developer console, if we browse a bit we will see that it tells us the IDs of each question.

We are going to copy and link to the corresponding data.

With this you will have your own database, and you will be able to export the results in CSV format.

 

Project File:

https://github.com/ikicapitan/Google-Forms