[英]A fillable table in Google Forms that records data in a specific Google Sheet
I'm trying to create a table with editable cells in a google form that lets people enter their recorded measurements.我正在尝试在谷歌表单中创建一个包含可编辑单元格的表格,让人们输入他们记录的测量值。 Then compile that information into a Google Sheet by specified columns.然后按指定的列将该信息编译到 Google 表格中。
I have tried the Awesome table but I cannot seem to get the script to work.我已经尝试过 Awesome 表,但我似乎无法让脚本正常工作。
Broken Down, I need the Script to be able to:分解,我需要脚本能够:
This may be a simple question that I am overthinking.这可能是一个我想多了的简单问题。 But I am trying to avoid multiple questions on the same form, and think a table would be way easier.但我试图避免在同一张表格上出现多个问题,并认为一张表格会更容易。
As talked in the comments, since there is no table item in FormApp , this solution consists in sending a Sheet with a predefined table for users to fill.正如评论中所说,由于FormApp中没有表格项,因此该解决方案包括发送带有预定义表格的表格供用户填写。 They will press a button and send the data to a master sheet.他们将按下一个按钮并将数据发送到主表。
CODE代码
function sendData() {
//Gets the sheet is being edited
var sprsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = sprsheet.getActiveSheet();
//Gets the data introduced by the user
var range = sheet.getRange("A2:L2");
var values = range.getValues();
//Gets the target sheet
var mainsprsheet = SpreadsheetApp.openById("main sheet id");
var targetSheet = mainsprsheet.getActiveSheet();
//Adds a new row to the target sheet with the collected data
targetSheet.appendRow(values);
//Clear the cells (optional)
range.clearContent();
}
BUTTON按钮
To create the "submit" button to run the function above:要创建“提交”按钮以运行上面的 function:
sendData
单击“分配脚本”并编写sendData
You can place the button anywhere and resize it.您可以将按钮放置在任何位置并调整其大小。
NOTES笔记
REFERENCES参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.