使用上次回复中的数据预填一个Google表单 [英] Prefill a Google Form using data from the last response

查看:164
本文介绍了使用上次回复中的数据预填一个Google表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Google表单,我是唯一使用的表单。我每天使用这个表格2次(或多或少),我希望一些字段预先填入我给出的最后一个响应的值,因为它们的值不会经常改变。



我将回复保存在Google电子表格中,以便从那里获取他们,但我对Google Apps脚本非常陌生,并且我没有看到有人打开表单回答时触发的事件还没完成。我甚至不确定这样的事件是否存在......



另外,我想从始终使用相同的URL访问我的表单(因此没有这种预填写方式)因为我在我的智能手机的桌面上保存了URL作为收藏夹,并且不想每天更改它):

那么,有没有办法预先填充Google表单使用上次回复中的数据或至少回复表单时触发的事件



提前致谢

解决方案

同时存在表单提交打开触发器。在Apps脚本代码编辑器中,点击资源菜单。创建一个与表单绑定的Apps脚本。在表单编辑器中有一个工具菜单。使用工具菜单打开Apps脚本代码编辑器。



因此,从电子表格中检索最后一个值是可行的。我无法找到任何让我认为可以预先填写表单字段的内容。但我希望我错了,有人有答案。

如果某个响应字段是一个脚本,它可以将最后一个值写入新行空。因此,如果您想要写入相同的值,则不必预先填充字段,只需将其保留为空。虽然,如果你不知道这个值是什么,你可能不知道这是你想再次输入的值。



尽管如此,还是有办法解决的。您可以将电子表格中的最后一个值写入表单项的帮助文本。





因此,您可以通过查看帮助文本知道最后一个值是什么。



或者我想知道是否可以在列表项中设置选项:



Google文档 - 设置选项



如果您想做更多工作并学习HTML,您可以使用HTML应用程序完成您的任务。



Google文档 - HTML服务


I am building a Google Form that I am the only one to use. I use the form 2 times a day (more or less) and I would like some of the fields to be prefilled with the value of the last response I gave, because their values are not suppose to change often.

I save my responses in a google spreadsheet so I could get them from there but I am very new to Google Apps Scripts and I haven't seen an event that triggers when someone opens a form to answer it yet. I'm not even sure such an event exists...

And also, I would like to access my form from always the same URL (so no prefill that way) because I saved the URL as a favorite on my smart-phone's desk and don't want to change it every day :)

So, is there a way to prefill a Google Form using data from the last response or at least an event that triggers when answering the Form ?

Thanks in advance

解决方案

There is both an On Form Submit and On Open trigger. In the Apps Script code editor, click on the Resources menu. Create an Apps Script that is tied to the form. There is a Tools menu in the Form Editor. Use the Tools menu to open the Apps Script code editor.

So, retrieving the last value from the spreadsheet is doable. I can't find anything that makes me think you can pre-fill a form field. But I hope I'm wrong, and somebody has the answer.

You could have a script that simply writes the last value to the new row if a certain response field is empty. So instead of pre-filling the field, just leave it empty if you want the same value written. Although, if you don't know what that value is, you might not know if that's what you want entered again.

There is a way to deal with that though. You could write the last value in the spreadsheet into the help text of the form item.

Google Documentation - Form Set Help Text

So, you could know what the last value was by looking at the help text.

Or I'm wondering if you could set the choices in a List Item:

Google Documentation - Set Choices

If you want to do more work, and learn HTML, you can do what you want with an HTML app.

Google Documentation - HTML Service

这篇关于使用上次回复中的数据预填一个Google表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆