Look at the Form submit event object
https://developers.google.com/apps-script/guides/triggers/events
Namely, namedValues
, which returns an object like this:
{
'First Name': ['Jane'],
'Timestamp': ['6/7/2015 20:54:13'],
'Last Name': ['Doe']
}
Note that all the values get returned in an array, even if it's just one value.
To get the information from this object, you can do the following:
let values = e.namedValues
let name = values.Firstname[0] // assigning first item (only item) of Firstname array to name
let email = values.email[0] // assigning first item (only item) of email array to email
These properties Firstname
and email
may be different depending on how you named them in your form.
It seems you were trying to call the properties as if they were functions - values.Firstname()
- which will not work, unless you can find that function defined in the documentation. Or maybe these are functions that are defined elsewhere in your script.
References
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…