Google表单:将数据发送到电子表格 [英] Google Forms: Send data to spreadsheet
问题描述
如何将数据从网络表单发送到Google电子表格?我使用Google Drive做了一个表单,但为了让自定义CSS运行,我需要复制表单标记。
在我的情况中,这是Google为send按钮行为
< form action =https://docs.google.com/forms/d/113H_71nd98TWE0bByjHYNpnC-
oVA6OBDWtppU30rBrU / formResponsemethod =POSTid =ss-formtarget =_ selfonsubmit =>
然而,我想从我自己设计的表单发布数据到上述Google Form Response电子表格。这里是我的表单代码(使用Bootstrap 3):
$ p $ < form class =form-horizontalrole =form ID = FTK接触 >
< h4>立即与我们联系< / h4>
< div class =form-group>
< label for =inputTypeclass =col-lg-2 control-label>查询类型< / label>
< div class =col-lg-10>
< select class =form-controlid =inputType>
< option>要求报价< / option>
< option>申请Bluebook< / option>
< option>一般查询< / option>
< / select>
< / div>
< / div>
< div class =form-group>
< label for =inputNameclass =col-lg-2 control-label> Name *< / label>
< div class =col-lg-10>
< input type =textclass =form-controlid =inputNameplaceholder =Your Name>
< / div>
< / div>
< div class =form-group>
< label for =inputEmailclass =col-lg-2 control-label> Email *< / label>
< div class =col-lg-10>
< input type =emailclass =form-controlid =inputEmailplaceholder =Your Email>
< / div>
< / div>
< div class =form-group>
< label for =inputCompanyclass =col-lg-2 control-label>公司< / label>
< div class =col-lg-10>
< input type =textclass =form-controlid =inputCompanyplaceholder =Your Company Name>
< / div>
< / div>
< div class =form-group>
< label for =messageclass =col-lg-2 control-label> Message *< / label>
< div class =col-lg-10>
< / div>
< / div>
< div class =form-group>
< label for =inputPhoneclass =col-lg-2 control-label> Phone< / label>
< div class =col-lg-10>
< input type =telclass =form-controlid =inputPhoneplaceholder =Your Phone Number>
< / div>
< / div>
< div class =form-group>
< label for =inputWebclass =col-lg-2 control-label> URL< / label>
< div class =col-lg-10>
< input type =urlclass =form-controlid =inputWebplaceholder =Your Website URL>
< / div>
< / div>
< div class =form-group>
< div class =col-lg-offset-2 col-lg-10>
< button type =submitclass =btn btn-primary btn-lg>立即发送您的查询< / button>
< / div>
< / div>
< / form>
使用上述Google表单操作= ...当按下时,我会转到原始Google表单发送,而不是将表单条目复制到电子表格中。
如果上述方法无效,我还可以将表单数据发送到电子邮件或Google Drive? / b>
以下是我的工作内容:
- 创建自定义表单
- 复制HTML代码从< form>开始;直至< / form>
- Google表单中的每个输入字段都具有名称和ID属性,需要将其复制到您的个人表单中
- 在表单中使用Google表单的表单操作中的网址
- 确保提交按钮的ID和名称属性均与Google表单来源匹配。
- 如果您现在进行提交,它会将您带到Google表单响应页面。您可以通过提交ajax表单来避免这种情况。 如果您的自定义表单不验证Google表单必填元素,那么您将再次被重定向到Google表单页面。
- Create your custom form
- Create your Google form and view the source after clicking view live form
- Copy the html code starting from <form> till </form>
- Each of the input fields in the Google form have name and id attributes which need to be copied to your personal form
- Use the URL in the form action of Google forms in your form.
- Make sure that even the submit button has the ID and name attributes matching with the Google form source.
- If you make a submit now, it will take you to the Google form response page. You can avoid this by making an ajax form submit.
How can I send the data from a webform to a google spreadsheet? I made a form with Google Drive, but to get custom CSS running, I need to copy the form tag.
In my case, that is what google generated for the send button behavior
<form action="https://docs.google.com/forms/d/113H_71nd98TWE0bByjHYNpnC-
oVA6OBDWtppU30rBrU/formResponse" method="POST" id="ss-form" target="_self" onsubmit="">
However, I want to post data from my own designed form to the above Google Form Response spreadsheet. Here is my form code (using Bootstrap 3):
<form class="form-horizontal" role="form" id="ftk-contact">
<h4>Get in touch with us now</h4>
<div class="form-group">
<label for="inputType" class="col-lg-2 control-label">Type of Inquiry</label>
<div class="col-lg-10">
<select class="form-control" id="inputType">
<option>Request a Quotation</option>
<option>Request a Bluebook</option>
<option>General Inquiry</option>
</select>
</div>
</div>
<div class="form-group">
<label for="inputName" class="col-lg-2 control-label">Name *</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="inputName" placeholder="Your Name">
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-2 control-label">Email *</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="inputEmail" placeholder="Your Email">
</div>
</div>
<div class="form-group">
<label for="inputCompany" class="col-lg-2 control-label">Company</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="inputCompany" placeholder="Your Company Name">
</div>
</div>
<div class="form-group">
<label for="message" class="col-lg-2 control-label">Message *</label>
<div class="col-lg-10">
<textarea class="form-control" rows="5" placeholder="Your Message"></textarea>
</div>
</div>
<div class="form-group">
<label for="inputPhone" class="col-lg-2 control-label">Phone</label>
<div class="col-lg-10">
<input type="tel" class="form-control" id="inputPhone" placeholder="Your Phone Number">
</div>
</div>
<div class="form-group">
<label for="inputWeb" class="col-lg-2 control-label">URL</label>
<div class="col-lg-10">
<input type="url" class="form-control" id="inputWeb" placeholder="Your Website URL">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="submit" class="btn btn-primary btn-lg">Send your Inquiry now</button>
</div>
</div>
</form>
When using the above Google form action=... I am taken to the original Google Form when pressing send, instead of the form entries being copied to the spreadsheet.
If the above approach wont work, how else can I send the form data to email or Google Drive?
Here's what worked for me:
If your custom form does not validate a Google form mandatory element, then you will again be redirected to the Google form page.
这篇关于Google表单:将数据发送到电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!