简体   繁体   English

插入新行并根据单元格文本移动数据

[英]Insert new row and move data based on cell text

Trying to automate a Google sheet to save time for a team member. 尝试自动执行Google表格以节省团队成员的时间。 I have zero scripting experience. 我的脚本编写经验为零。 I am trying to insert a row based on a "Yes" result from column K in a Google form submission sheet and then move data in cells L:P to the new row, all without messing up the query functions that are pulling this data. 我试图根据Google表单提交工作表中第K列的“是”结果插入一行,然后将单元格L:P中的数据移动到新行,而不会弄乱正在提取此数据的查询功能。

Is this possible? 这可能吗?

Appending selected data from a form submission 附加表单提交中的选定数据

function onFormSubmit(e) {
  var ss=SpreadsheetApp.openById('SpreadsheetID');
  var sh=ss.getSheetByName('Sheet Name')
  if(e.values[11]=="Yes") {
    var nV=e.values.slice(11,16);
    ss.appendRow(nV);
  }
}

Since you said that you have zero scripting experience, I should warn you that you cannot run this function without supplying the event object and personally I would never append new rows to a linked sheet. 既然您说您的脚本编写经验为零,所以我应该警告您,如果不提供事件对象就不能运行此函数,而且我个人绝不将新行添加到链接表中。 I would append the rows to another sheet instead. 我会将行附加到另一张纸上。 There have been problems with the onFormSubmit trigger lately which causes spurious additional triggers as described here . 目前已与onFormSubmit触发最近这导致虚假额外的触发器所描述的问题在这里

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM