Accessing object is Google App Script

2019-06-03 10:16发布

I am actually following the HtmlService documentation (https://developers.google.com/apps-script/html_service) in creating a form. I notice there is this part where it says it will be an object after user submit the form and the structure will be like this:

{ myFile: <a Blob containing the file>; aField: <the value in the field> }

Can I know how can I access to those object in Google App Script?

1条回答
贪生不怕死
2楼-- · 2019-06-03 11:00

In your server code:

function processForm(theForm) {
  Logger.log(theForm.aField);
  Logger.log(theForm.myFile.getName());
}

In your HTML:

<form id='myForm'>
<input name='myFile' type='file'>
<input name='aField'>
</form>
<script>
google.script.run.processForm(document.getElementById('myForm'));
</script>
查看更多
登录 后发表回答