html - 如何使用 Google 电子表格作为后端创建 HTML 数据输入表单

标签 html r google-apps-script google-sheets google-forms

我有一个谷歌电子表格,每天都会添加一些行,并使用谷歌电子表格,客户反馈团队跟进。

谷歌电子表格数据。

https://docs.google.com/spreadsheets/d/1V-XZdCUZAQVkfCat9vXVxITjjNMxNMPDin6B5j9uMWY/edit?usp=sharing

上面提到的谷歌电子表格总是在谷歌表中有下面提到的数据(以蓝色突出显示):

引用编号
公司名
联系方式 1
联系方式 2
项目名
代理 ID

其余提到的细节将根据用户响应从 HTML UI 中捕获,最后单击“提交和下一步”或“下一步”,输入将存储在谷歌表中。

用户必须首先在 HTML UI 上输入“代理 ID”,然后逐一输入 Ref ID详细信息将提供给特定的“代理 ID”用户。

如所附屏幕截图中所述,根据 googlespread 表,信息的左侧将是静态的,右侧信息将由用户根据电话对话填写。

下面提到的细节将是下拉或单选选项基于用户输入:

Product : Lite, Lite-I, Elite
Ref Code: LIT-1, LIT-2, LIT-3
Status  : Accept, Reject, Pending
Comment : Satisfied, Call Back, Pending

下面提到的细节将得到:
Days Passed: It will be derived from the current system year - year mentioned in the `Date`

下面提到的细节将是用户输入的自由文本。
Client Name
Notes
Final_Status

注:代理将被分配并仅显示那些 Ref ID哪里Agent ID不是空白和 Final_Status为空白或不是 Google 电子表格中标记的“提交和下一步”。

我们需要在 Googlespread 表中再添加一列,它根据系统日期尽快捕获日期时间戳 Final_Status标记为“提交和下一步”或“下一步”

提交和下一步按钮只有在用户捕获所有详细信息时才会启用。
只有在 Comment 时才会启用下一步按钮选项被选中。

此外,如果使用 UI 的数据输入在 googlesheet 中没有可用的新行,则 UI 将通过单击“提交和下一步”或“在空白屏幕上向用户抛出“没有新任务可用”的消息下一步'按钮。

预期用户界面:

enter image description here

最佳答案

看起来 Google Apps Developer docs 有一个类似的指南:

Useful for building web apps or adding custom user interfaces in Google Docs, Sheets, and Forms.



https://developers.google.com/apps-script/guides/html

看起来您需要授予 Google Apps Scripts 访问权限,然后添加一个:

https://developers.google.com/apps-script/guides/standalone

你可以创建一个独立的脚本,或者手动连接你的项目:

Go to Google Drive and click New > More > Connect more apps.

When the "Connect apps to Drive" window appears, type "script" into the search box and press Enter.

Click Connect next to the listing for Google Apps Script.



谷歌的脚本示例说你的脚本看起来像这样:
function onOpen() {
  SpreadsheetApp.getUi()
      .createMenu('Dialog')
      .addItem('Open', 'openDialog')
      .addToUi();
}

function openDialog() {
  var html = HtmlService.createHtmlOutputFromFile('Index');
  SpreadsheetApp.getUi() 
      .showModalDialog(html, 'Dialog title');
}

使用相应的 HTML:
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
   My Google Sheets Interface.
    <input type="button" value="Close"
        onclick="google.script.host.close()" />
  </body>
</html>

这里似乎有很好的文档:

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app

所以我想说这是一个很好的起点。您想要实现的目标看起来肯定是可行的,我认为将其调整为谷歌脚本支持的问题。

祝你好运!!

关于html - 如何使用 Google 电子表格作为后端创建 HTML 数据输入表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59288795/

相关文章:

R 包 DT - 如何突出显示每行最大值

google-apps-script - Google 脚本 - 在 Google 文档表中插入图像

html - 如何优化网站以在移动设备上很好地显示

html - 单选按钮在 Internet Explorer 中不起作用/不可选择

java - JSOUP 带有加载文本和圆圈的网页抓取页面

google-apps-script - 通过 Google Apps 脚本发布 Google 电子表格

javascript - 何时比较 'for' 循环中的多个数组

jquery - Animate.css 问题 : The page becomes super large

RPART - 特征类型

r - 将命名向量转换为 R 中的列表