0
votes

I have a question about web apps in Google Script. For example: I created a web app based on a form with some 4 text fields and my final link is something like this: https://script.google.com/macros/s/xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz/exec

So, I want to know if it's possible to open the web app (form) with pre-filled textfields, for instance, the 4 textfields will have the values: 10,20,30 and 40.

I try something like this: https://script.google.com/macros/s/xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz/exec?txt1=10

Can you recommend me a way to do that?

Regards,

1
you are close. inspect the e param in your doGet(e) and you will find the parameters.Zig Mandel

1 Answers

1
votes

As Zig Mandel suggests in his comment, the e event object of the doGet(e) or doPost(e) functions has specific parameters as defined in this Google Apps reference. You could use e.parameters to access the parameters passed to the web app via the URL query string.

However, if the values are known in advance, wouldn't it be better to pre-fill the text fields via the HTML of your web app? Something like:

<input type="text" name="txt1" value="10" >
<input type="text" name="txt2" value="20" >
<input type="text" name="txt3" value="30" >
<input type="text" name="txt4" value="40" >

I may be misunderstanding your exact context, but this would be an easier approach.