简体   繁体   English

如何使用应用程序脚本制作Google表单

[英]How to make a google form using apps script

I want to make a google form in apps script that will be like an inventory check out/in form. 我想在应用程序脚本中制作一个Google表单,就像库存签出/签入表单一样。 I want all the options to be under the check out section and every time a response gets submitted for checking out an item, the next time the form opens that item will appear under the check in section. 我希望所有选项都在“检出”部分下,并且每次提交用于检出项目的响应时,下次打开该表单的表单都将出现在“检入”部分下。 I also want the item to go from check in to check out as well but I'm not even sure that functionality is available, just thought I'd put it out there. 我也希望该项目也能从签入到签出,但我什至不确定该功能是否可用,只是以为我会把它放在那里。 I started creating the form but I'm not sure where to go from here, the documentation for apps script isn't the most detailed. 我开始创建表单,但不确定从何处去,有关应用程序脚本的文档不是最详细。

//variable for new form
var newForm = FormApp.create('CS IT Checkout Form test');
//making name field
var name = newForm.addTextItem();
//variable for email
var email = newForm.addTextItem();
//variable for checkout checkboxes 
var checkBoxItem = newForm.adCheckBoxItem();
//variable for checkin checkboxes
var checkBoxItem2 = newForm.addCheckboxItem();
function myFunction() {
  //making description
  newForm.setDescription('Checkout and check-in form for CS tech');
  //making name field
  //at some point make the name field required or just do it in actual 
form
  name.setTitle('Name');
  //making email field
  email.setTitle('Email')
  //making checkout equipment fields
  checkoutItem.setTitle('Check Out');
  //default options until responses  are made then it begins to change
checkBoxItem.setChoiceValues(['Laptop', 'Tablet', 'Monitor', 'Camera']);
  //once form submissions start values will be put in the check in section 
  checkBoxItem2.setTitle('Check In');
  checkBoxItem2.setChoiceValues();
}

Writing this as an answer rather than a comment because formatting. 将其写为答案而不是评论是因为格式化。

First you have to figure out a flow that would work for what you want. 首先,您必须弄清楚适合您想要的流程。 Does this sound about right? 这听起来对吗?

I think you need a form, and an inventory spreadsheet connected to that form. 我认为您需要一个表单,以及与此表单连接的库存电子表格。

The form asks the user whether it is a check/check out choice, and then the user select the appropriate item from the correct dropdown (check in or check out). 该表格会询问用户这是否为签入/签出选项,然后用户从正确的下拉列表中选择适当的项目(签入或签出)。 I think you can tie this logic to a first page yes/no, but I haven't tried it. 我认为您可以将此逻辑绑定到首页是/否,但是我还没有尝试过。 So worst case scenario three questions and they leave one dropdown blank. 因此,最坏的情况是三个问题,它们留空了一个下拉列表。 tie the form to the spreadsheet. 将表单绑定到电子表格。

You need an onsubmit function in the spreadsheet that does the following: 您需要在电子表格中执行以下操作的onsubmit函数:

  • Determine whether the form was checking in or checking out 确定表单是签入还是签出
  • Move the item to the appropriate sheet (two otherwise identical sheets for items that are checked in, and checked out). 将项目移动到适当的工作表(对于其他已签入和签出的项目,则使用两张相同的表)。
  • Update the values for the form with the right items in the dropdown 在下拉菜单中使用正确的项目更新表单的值

Now it is ready for the next usage. 现在已准备好下次使用。 Is this what you envision? 这是您所设想的吗?

实际上,我不需要将信息存储在工作表中,而是想出了如何通过创建一个函数来获取最新响应并将其传递给另一个为新部分创建新选择的函数的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使提交功能在使用 Google Apps 脚本创建并嵌入 Google 站点的 Web 表单中工作? - How to make submission function work in a web form that is created using Google Apps Script and embedded in a Google Site? 如何使用谷歌应用程序脚本将谷歌表单附加到谷歌电子表格? - How to attach google form to google spreadsheet using google apps script? 如何使用Google Apps脚本为Google表单中的项目设置父项? - How to set the parent for item in a google form using google apps script? 如何使用 Google Apps Script 或 GAS 创建 Google Form Quiz? - How to create Google Form Quiz using Google Apps Script or GAS? 如何使用Google Apps脚本考虑Google表单中的空白答案? - How to consider empty answers in Google form using Google Apps Script? 如何使用 Google 应用程序脚本在 Google 表单中进行简单的身份验证? - How to make a simple authentication in Google Forms using Google apps script? 使用 Google Apps 脚本填写 Google 表单 - Fill Google form using Google Apps Script 如何使用Google Apps脚本处理表单? - How can I process a form using Google Apps Script? 如何使用Google Apps脚本检查表单中的值 - How to check a value in a form using Google Apps Script 使用 Apps 脚本在 Gmail 中嵌入 Google 表单 - Embed Google Form in Gmail using Apps Script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM