How to send variable and image to google script editor

Hello everyone !

I look on many topics but i can’t find explicit solution.

So i’m asking for :

  1. I have created a script, but I would like to know exactly which URL to enter in the advanced parameters of web_api to create my link with.

  2. I would like to send to my script initialized variables from my project on thunkable in order to be able to process them directly from my script.

  3. is it possible to send images directly from thunkable to be able to store them on my google drive

cf view :



Re !

i try to do this to see fault or anything.

And i have that : response : >htmlclass=“google mmfb” lang=“en”><scriptnonce="XE9… etc etc
statut : 200
error : undefined

please help me :slightly_frowning_face:

i don’t understand because my register under block do correctly the task

Hey there, the thing is your apps script project has 3 problems.

The first problem is that you forgot to add parameters between event and nom/prenom.

The second problem is to rename event to e.

Fixed code:

function doPost(e) {

  var nomClient = e.parameters.nom;
  var prenomClient = e.parameters.prenom;

  DriveApp.createFolder("Mr " + nomClient + " " + prenomClient);
};

The third problem is that in Thunkable you put the wrong URL in the API URL. In order to put the correct URL, you need to publish you Apps Script problem as a web app.

Steps:
To deploy a script as a web app, follow these steps:

  1. At the top right of the script project, click Deploy > New deployment.
  2. Next to “Select type,” click Enable deployment types settings > Web app.
  3. Set “Execute as” to Me and then set “Who has access” to Anyone
  4. Click Deploy.

Then just paste the URL you get into the Web API’s URL block you have.

I think that’s all!

3 Likes

Hi Shrey !

Thanks for your solutions, i think my URL is good now.

But for my queryparameters in thunkable view, it’s not copy to my script on google, i don’t understand why… An idea ?

image

This next view is my fonction to post on my Google drive.
The purpose of this function is to retrieve all kinds of information stored in my sthunkable variables to my script in order to be reprocessed later.
There is also a sending of these variables to a google sheets in order to have a register of requests sent via the thunkable application. Which, by the way, works very well! :slight_smile:

Probably my problem is on that part with a wrong url ? I don’t know how to put a right url with a key finding on google drive api. Do you have a method to explain to me ?

You dont need to put the google drive api in thunkable. You can just enable the google drive api on the left side of apps script where it says services.

EDIT: Sorry, I misunderstood you.

What I don’t understand is that with my current thunkable code and my script, as soon as I simulate with my mobile phone, I should have my script that is triggered and create a folder for me with the first and last name with my variable from thunkable?

But none of this, so I guess my variables don’t make it to the script.

Does the folder get created? If yes, is the folder’s name blank or does it just show “Mr”?

Hi,

the folder isn’t created :slightly_frowning_face:

I get that when i use debug mode :

Try running the script from your Thunkable app instead.

Hello !

i do that :

and when i submit by thunkable on mobile, it works halfway. This creates a folder for me at the root of my google drive with the first and last name that I entered in thunkable, however afterwards it blocks on the sheet creation line. I feel like it was like the value of the variables jumped to the previous line…

For example i do that :

You can see the script with constant variable do perfectly the task. My problem, i think, is between thunkable and my script. My script can’t get receive variable or thunkable does anything…

I try this method, it doesn’t running work either…

An idea ?

Hello World !

There is someone to help me hier please ?

@shrey ??

I’m sorry, but I don’t have access to a computer right now, so I won’t be able to help you right now.

Hello World !

I need help please, realy… I don’t find my probably errors…

1 Like

In Google Scripts there are parameters and also parameter. You need to check which one works for you.

When the debug says parameters is undefined it means it has not been created by the event object.

Hi, thanks @muneer for your answer.

I try with “parameter” and “parameters”, but when i submit by thunkable mobile application, it doesn’t run on my googgle script.

You can look on previous view that i create on thunkable a second method to send the same variables on a google sheet. And this method run perfectly.

So, from my point of view, i think errors are in my part of code of my button submit on thunkable.

here are the latest updated pictures :

google script

funtion submit in thunkable

Thanks for your help !

1 Like

The blocks you shared don’t contain any parameters and therefore nothing will be passed to the Google Apps Script.

you are using web_API Body to pass parameters which is not what the GAS is trying to retrieve.

To use the e.parameter or e.parameters you have to use web_API QueryParameters
image

1 Like

So, I changed as you recommanded my thunkable like this :

But it doesn’t run yet. Do you have an idea ?

1 Like

I assume you already tested that the Google Apps Script is deployed as web app.

Also, run the blocks from your mobile because API calls from the computer is nor consistent.

See a sample project I made
https://x.thunkable.com/projectPage/618cfa678cdb0f0011998dbe


This is the corresponding GAS.